Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R xj[i]中出错:下标类型无效';列表';随机森林中的误差_R_Random Forest - Fatal编程技术网

R xj[i]中出错:下标类型无效';列表';随机森林中的误差

R xj[i]中出错:下标类型无效';列表';随机森林中的误差,r,random-forest,R,Random Forest,我正在使用airbnb数据集。清理后,我尝试应用一个随机森林(我做了一棵树和一棵修剪过的树,它们都成功了)。我没有很多经验,但以下是我的代码: split_index <- createDataPartition(airbnbcleanedfinal$logprice, p = 0.8, list = F) #Use index to split data training<-training <- airbnbcleanedfinal[split_index,] train

我正在使用airbnb数据集。清理后,我尝试应用一个随机森林(我做了一棵树和一棵修剪过的树,它们都成功了)。我没有很多经验,但以下是我的代码:

split_index <- createDataPartition(airbnbcleanedfinal$logprice, p = 0.8, list = F)

#Use index to split data
training<-training <- airbnbcleanedfinal[split_index,]
training1 <- airbnbcleanedfinal[sample(nrow(airbnbcleanedfinal),100000,replace=TRUE),]
features_test <- airbnbcleanedfinal[-split_index, !(colnames(airbnbcleanedfinal) %in% c('logprice'))]
target_test <- airbnbcleanedfinal[-split_index, 'logprice']

library(randomForest)


rf_train <- randomForest(logprice ~ ., data = airbnbcleanedfinal,
                         subset=training,
                         mtry = 5)

split\u index你能分享一个你用于
randomForest()
的数据样本吗?我刚刚添加了一张我的数据图片。我们真的希望有一个我们可以轻松使用的数据样本。看看这个关于可复制的例子。