R 不同文件中向量的相关性

R 不同文件中向量的相关性,r,R,我在工作目录中的不同(.R)文件中存储了一些向量(大约50个)。所有对象都使用相同的名称命名。假设 A <- c(1,5,15, 25, 8, 20) A一种方法是: fileList <- list.files(pattern="\\.R") library(Hmisc) rcorr(sapply(fileList, function(x) source(x)$value))$r 文件列表 fileList <- list.files(pattern="\\.R"

我在工作目录中的不同(.R)文件中存储了一些向量(大约50个)。所有对象都使用相同的名称命名。假设

A <- c(1,5,15, 25, 8, 20)
A一种方法是:

 fileList <- list.files(pattern="\\.R")
 library(Hmisc)
 rcorr(sapply(fileList, function(x) source(x)$value))$r
文件列表
 fileList <- list.files(pattern="\\.R")
 library(Hmisc)
 rcorr(sapply(fileList, function(x) source(x)$value))$r