下面的都是同一个例子,报不同的错,怎么样能算出正确结果啊
(1)> library(randomForest)
randomForest 4.6-10
Type rfNews() to see new features/changes/bug fixes.
>insect<read.csv("d:/data/insects.csv",header=TRUE)
> RF1<-randomForest(insect[c('L1','L2','L3','L4')],insect['species'],importance=TRUE,ntree=10000)
Error: unexpected input in "RF1<-randomForest(insect[c('L1','L2','L3','L4')]?
(2)> library(randomForest)
randomForest 4.6-10
Type rfNews() to see new features/changes/bug fixes.
> insect<-read.csv("D:/data/insects.csv",header=TRUE)
> RF1<-randomForest(insect[c('L1','L2','L3','L4')],insect['species'],importance=TRUE,ntree=3000)
Error in `[.data.frame`(insect, "species") : undefined columns selected
> RF1<-randomForest(insect[c('L1','L2','L3','L4')],insect['Species'],importance=TRUE,ntree=3000)
Error in randomForest.default(insect[c("L1", "L2", "L3", "L4")], insect["Species"], :
length of response must be the same as predictors
In addition: Warning message:
In randomForest.default(insect[c("L1", "L2", "L3", "L4")], insect["Species"], :
The response has five or fewer unique values. Are you sure you want to do regression?
> RF1<-randomForest(insect[c('L1','L2','L3','L4')],insect['Species'],importance=TRUE,ntree=3000)
Error: unexpected input in "RF1<-randomForest(insect[c('L1'?
> RF1<-randomForest(insect[c('L1','L2','L3','L4')],insect['species'],importance=TRUE,ntree=3000)
Error: unexpected input in "RF1<-randomForest(insect[c('L1'?
> RF1<-randomForest(insect [c('L1','L2','L3','L4')],insect ['species'],importance=TRUE,ntree=10000)
Error: unexpected input in "RF1<-randomForest(insect [c('L1'?
>
补充:请问怎么样可以看到随机森林程序的源代码?如果能看到的话,可以进行断点调试么?
|