Function Errors
Object is not a data frame
Matches: object is not a data frame
WHAT THIS ERROR MEANS
A function expected a data frame but received a different object type (matrix, vector, list, etc.).
HOW TO FIX IT
1. Convert to a data frame with as.data.frame().
2. Check the type with class(your_object).
3. Make sure you assigned the result correctly.
CODE EXAMPLES
BAD — THIS CAUSES THE ERROR
mat <- matrix(1:9, nrow = 3) subset(mat, V1 > 2)
GOOD — CORRECT APPROACH
df <- as.data.frame(matrix(1:9, nrow = 3)) subset(df, V1 > 2)
Still stuck?
Paste your code in RChat and the AI will fix this error in context.
RELATED FUNCTION ERRORS
Function not found R doesn't recognize the function you're trying to call. The package containing i...
Unused argument You passed an argument to a function that doesn't accept it. This often happens ...
Missing required argument A function requires a specific argument that you didn't provide, and there's no ...
Argument matched multiple times You provided the same argument twice — once by name and once by position, or use...