在获取脚本时,绘图不起作用

问题描述 投票:0回答:1

当我通过单击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

r rstudio r-caret
1个回答
0
投票

只是评论,但无法在那里添加图片。当你回到一个地块时,你想要的情节会出现吗?见图。

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.