train <- read.csv("train.csv", strings=T)
test <- read.csv("test.csv", strings=T)
library(gamlr)
allX <- rbind(train[,-c(1,81)],test[-1])
allXnaref <- naref(allX, impute=T)
modMat <- sparse.model.matrix(~., data=allXnaref)[,-1]
This is my code for right now. When I run all the code above and then run the modMat code it gives me this error message:
Error in as.data.frame.default(data, optional = TRUE) :
cannot coerce class ‘"function"’ to a data.frame
I am stuck on what to do or fix because the code above is all correct. Do I need to fix something within my gamlr or in the code itself?
I have been trying to understand the error but on other computers the code works but does not work on mine. I have been trying the code over and over but my Professor and I are stuck on what is wrong with the code.