Error in eval(expr, envir, enclos) : object not found

前端 未结 4 1344
傲寒
傲寒 2020-12-08 05:45

I cannot understand what is going wrong here.

data.train <- read.table(\"Assign2.WineComplete.csv\",sep=\",\",header=T)
# Building decision tree
Train &l         


        
4条回答
  •  余生分开走
    2020-12-08 05:54

    i use colname(train) = paste("A", colname(train)) and it turns out to the same problem as yours.

    I finally figure out that randomForest is more stingy than rpart, it can't recognize the colname with space, comma or other specific punctuation.

    paste function will prepend "A" and " " as seperator with each colname. so we need to avert the space and use this sentence instead:

    colname(train) = paste("A", colname(train), sep = "")
    

    this will prepend string without space.

提交回复
热议问题