Some reserve words in R language are creating problem for Text Analytics

31 Views Asked by At

I have Document Term Matrix turned data frame with 352 observations of 1342 variables. Now when I try to run a randomforest model I get the error:

model <- randomForest(labels~ ., data = train_df, ntree = 100)

Error in model.frame.default(terms(reformulate(attributes(Terms)$term.labels)), : invalid type (special) for variable 'repeat'

I know 'repeat' is a reserve word in R, but how can I solve this issue. I cannot even change the column name in this condition and find it difficult to find a solution on net.

Help in this matter will be highly appreciated.

I have tried this but is doesnt help:

model <- randomForest(labels~ ., data = train_df, ntree = 100, `repeat` = train_df$`repeat`)
0

There are 0 best solutions below