r中一个图中多个方法的图交叉验证结果
我想在r中绘制一个绘图,如下图所示: 绘制上述预期图的数据如下所示: 方法1、2和3的逻辑回归3倍交叉验证分数r中一个图中多个方法的图交叉验证结果,r,plot,cross-validation,R,Plot,Cross Validation,我想在r中绘制一个绘图,如下图所示: 绘制上述预期图的数据如下所示: 方法1、2和3的逻辑回归3倍交叉验证分数 方法1\u LR我们可以从ls以mget作为list获取所有“方法”对象的值,将list转换为两列数据集(enframe),将列“名称”一分为二,使用ggplot2 library(dplyr) library(tidyr) library(ggplot2) library(tibble) mget(ls(pattern='^Method\\d+_[A-Z]+$')) %>%
方法1\u LR我们可以从
ls
以mget
作为list
获取所有“方法”对象的值,将list
转换为两列数据集(enframe
),将列“名称”一分为二,使用ggplot2
library(dplyr)
library(tidyr)
library(ggplot2)
library(tibble)
mget(ls(pattern='^Method\\d+_[A-Z]+$')) %>%
enframe %>%
unnest(value) %>%
separate(name, into = c("method", "cat"), sep="_") %>%
ggplot(aes(x = cat, y = value, fill = method)) +
geom_boxplot() +
theme_bw()
-输出
使用boxplot可以获得相同的信息,而不是单独绘制五个顶点