正如上面评论中提到的,我从 ggparcoord 中的数据中提取了异常值,并将它们分别绘制出来。这是现在的新代码:
library(devtools)
install_version("MMST", version = "0.6-1.1", repos = "http://cran.us.r-project.org")
MMST.out(dest.folder = '.',datasets='bodyfat')
a=ggparcoord(data = bodyfat, alphaLines = 0.2)
out1=which.max(a$data[a$data$variable=='hip',]$value)
out2=which.max(a$data[a$data$variable=='ankle',]$value)
df1=a$data[a$data$.ID==out1,]
df2=a$data[a$data$.ID==out2,]
a + geom_line(data = df1 ,aes(y=value), color='red', alpha=0.5) +
geom_line(data = df2 ,aes(y=value), color='blue', alpha=0.5)
这就是输出的样子:
具有突出显示的异常值的 PCP
谢谢您的帮助。