Get Started →
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.

Try RChat Free →

RELATED FUNCTION ERRORS