I use the function randomForestfrom the randomForest package to find the most important variable: my dataframe is called urban, and my response variable is revenue, which is numeric.
urban.random.forest <- randomForest(revenue ~ .,y=urban$revenue, data = urban, ntree=500, keep.forest=FALSE,importance=TRUE,na.action = na.omit)
I get the following error:
Error in randomForest.default(m, y, ...) : data (x) has 0 rows
in source code, it is associated with a variable x:
n <- nrow(x)
p <- ncol(x)
if (n == 0)
stop("data (x) has 0 rows")
but I can’t understand what it is x.
source
share