麻烦and纠结 发表于 2013-11-7 09:09 
首先 那个hr1与hr2我用mode函数弄 都是list,我用read.table()读取的数据它都是list,而且我用iris数据进行 ...
请读下面的,也许能知道“错在何处?”
library(randomForest)
randomForest 4.6-7
Type rfNews() to see new features/changes/bug fixes.
> data(iris)
> mode(iris)
[1] "list"
> str(iris)
'data.frame': 150 obs. of 5 variables:
$ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ...
$ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ...
$ Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ...
$ Petal.Width : num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ...
$ Species : Factor w/ 3 levels "setosa","versicolor",..: 1 1 1 1 1 1 1 1 1 1 ...
class(iris)
[1] "data.frame"
你的数据集是否是data.frame ,应用str() 或class() 来表征。
mode() 只表征数据类型,好象不能表征对象类型。。。