【发布时间】:2016-08-12 22:29:11
【问题描述】:
尝试使用Deducer 的cor.matrix 创建要在ggcorplot 中使用的相关矩阵。
尝试运行一个简单的示例。只有在数据中明确指定变量名才有效:
cor.mat<-cor.matrix(variables=d(Sepal.Length,Sepal.Width,Petal.Length,Petal.Width),
data=iris[1:4],test=cor.test,method='p')
但我希望它能够简单地使用所提供数据中的所有列。
这个:
cor.mat<-cor.matrix(data=iris[1:4],test=cor.test,method='p')
抛出错误:
Error in eval(expr, envir, enclos) : argument is missing, with no default
这个:
cor.mat<-cor.matrix(variables=d(as.name(paste(colnames(iris)[1:4]),collapse=",")),
data=iris[1:4],test=cor.test,method='p')
Error in as.name(paste(colnames(iris)[1:4]), collapse = ",") :
unused argument (collapse = ",")
那么有没有办法告诉variables 使用data 中的所有列而不明确指定它们?
【问题讨论】: