【发布时间】:2018-06-28 06:50:54
【问题描述】:
我正在尝试在 R 中为大约 14 个数据帧在 for 循环中运行相关性。代码在 for 循环之外工作(没有连接),但不在 for 循环中。给我错误 "non-numeric argument to binary operator"
Image showing one of the data frames in the for loop that the correlation is being run on
#for loop to go through each crime type
y<- unique(crimeSummary$cType) #To get the types of crime that I am trying to the run the corr on.
for(i in 1:length(y)){
cor.test(paste("mergedpoW"+y+"$total.x", sep = "."), paste("mergedpoW"+y+"$total.y",sep = "."))
}
【问题讨论】:
标签: r statistics data-science