【发布时间】:2016-09-22 17:10:56
【问题描述】:
所以我有一个非常大的数据框,在这个例子中是这样布局的:
line gene1 gene2 gene3 gene4 gene5 survival
1 4.05 7.65 0.25 0.789 10.5 0.90
2 2.51 4.36 12.5 7.56 8.99 0.50
3 3.65 2.55 48.8 5.65 5.89 0.25
4 5.65 1.54 8.99 9.2 0.01 0.10
唯一的区别是我在实际数据中处理了超过 18,000 个基因。 line 是指果蝇的遗传系,而每个“基因”列中的数字是指相对基因表达。 survival 是每行的存活比例。我想做的是将第 2 到 5 列(基因表达)与第 6 列(survival)关联起来。我已经用cor 试过了,效果很好:
cor1<-cor(master2[c(2:5)], master2$surv, method="pearson")
但是,我想使用 cor.test 或 corr.test(来自 psych 包)来输出 p 值并对其进行一些更正。
我试过了:
cor1<-cor.test(master2[c(2:5)], master2$surv, method="pearson")
然后得到:
Error in cor.test.default(master2[c(2:5)], master2$surv, method = "pearson") :
'x' and 'y' must have the same length
我也试过了:
cor1<-corr.test(master2[c(2:18141)], master2$surv, method="pearson")
得到:
Error in 1:ncol(y) : argument of length 0
任何帮助将不胜感激!!!
提前致谢,
菲尔
【问题讨论】:
标签: r statistics correlation genetics