下面的代码有问题:
library(ggplot2)
library(ggcorrplot)
data(USArrests)
correlation_matrix <- round(cor(USArrests),1)
corrp.mat <- cor_pmat(USArrests)
ggcorrplot(correlation_matrix, hc.order =TRUE, type ="lower",
p.mat = corrp.mat)当我运行代码时,执行会停止在ggcorrplot(.)我得到了一个错误:
“Math.data.frame中的错误(x=list(frame= c(0.0695,1.36e-07,2.6e-12 ),数据帧中的非数值类变量:行名)”
我试图在一个在线R运行程序中运行该代码,但是在RStudio中它没有运行。
我不知道怎么回事,有人有主意吗?
发布于 2022-09-04 05:01:59
谢谢你的建议。卸下不必要的包裹是有帮助的。包rstatix似乎干扰了cor_pmat()命令。
https://stackoverflow.com/questions/73594347
复制相似问题