请帮助 我收到此错误;
eval(predvars,data,env)中的错误:找不到对象'medv'
我的代码
# LM
set.seed(7)
fit.lm <- train(medv~., data=dataset, method="lm", metric=metric, preProc=c("center",
"scale"), trControl=trainControl)
我的数据确实有medv;
>print(DTset)
CRIM ZN INDUS CHAS NOX RM AGE DIS RAD TAX PTRATIO B LSTAT MEDV
2 0.02731 0.0 7.07 0 0.4690 6.421 78.9 4.9671 2 242 17.8 396.90 9.14 21.6
3 0.02729 0.0 7.07 0 0.4690 7.185 61.1 4.9671 2 242 17.8 392.83 4.03 34.7
4 0.03237 0.0 2.18 0 0.4580 6.998 45.8 6.0622 3 222 18.7 394.63 2.94 33.4
答案 0 :(得分:0)
r区分大小写
set.seed(7)
fit.lm <- train(MEDV~., data=dataset, method="lm", metric=metric, preProc=c("center",
"scale"), trControl=trainControl)