cobaltchaos
cobaltchaos

Reputation: 49

Error in eval(predvars, data, env) : object 'TRAFD1|10906' when using randomforest()

I am running randomforest() with the following code:

rf<-randomForest(ED_AP ~., new)

new has the structure (truncated, there are 600 columns of genes, 182 rows of samples):

     ED_AP  TRAFD1|10906 SELL|6402 SEPT6|23157 LRBA|987
6XX    yes          243      7392        1185      557
1XX2   yes          203      4447        2104     1003
XX67    no          144      3362         729      416
16XX    no          189      2704         843      654
1XX4   yes          234      4745        3005     1053

I've seen similar posts, but the functions we're either not attached, the objected we're not columns in the data frame... Any thoughts would be appreciated!

I've tried various other mechanisms, including:

formula<-new$ED_AP~.
rf<-randomForest(formula, new)

randomForest(formula= ED_AP ~., data= new)

rf<-randomForest(new$ED_AP ~.,data =new)

All return the same error. Some sanity checks:

is.factor(new$ED_AP)
[1] TRUE

is.data.frame(new)
[1] TRUE

Thank you!

Upvotes: 2

Views: 969

Answers (1)

Dlvol3
Dlvol3

Reputation: 31

try run this before the RF model line

names(new) <- make.names(names(new))

Upvotes: 3

Related Questions