当我通过单击RStudio中的Source来运行整个文件时,我没有获得由插入符生成的变体重要性的图。点的正常绘图似乎有效。
奇怪的是 - 只运行该线似乎工作正常。代码重现如下:
library(caret)
data("PlantGrowth")
PlantGrowth$test1 <- sample(1:2, 30, replace=TRUE)
control <- trainControl(method="repeatedcv", number=10, repeats=3)
model <- train(group ~ ., data=PlantGrowth, method="lvq", preProcess="scale",
trControl=control)
# estimate variable importance
importance <- varImp(model, scale=FALSE)
# summarize importance
print(importance)
# plot importance
plot(4, 5)
plot(importance)
plot(2, 3)
通常会出现两个点图,但在获取文件时重要性不会出现。 RStudio版本:1.1.453