如何在具有相同列数但不同行的两个数据帧之间运行相关性测试?

问题描述 投票:0回答:0

因此,我使用 xCell 软件包来比较两组 - HPV+ 头颈癌病例和 HPV+ 宫颈癌病例。但是,当我尝试运行代码时:

Cesc = xCell_analysis_CESC_POS_FINAL[rownames(scores),colnames(xCell_analysis_CESC_POS_FINAL)]
Cor = corr.test(cesc_test, hnsc_pos_test,adjust='none')
qplot(x=rownames(Cor$r),y=diag(Cor$r),
      fill=diag(Cor$p)<0.05,geom='col',
      main='HPV+ HNSC vs HPV+ CESC',
      ylab='Pearson R', xlab= "") + labs(fill = "p-value<0.05") +
  theme_classic() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))

我收到一条错误消息:

Error in cor(x, y, use = use, method = method) : incompatible dimensions

所以基本上我发现问题出在第二行代码中:

Cor = corr.test(cesc_test, hnsc_pos_test,adjust='none')

因为数据帧“cesc_test”和“hnsc_pos_test”都具有相同的列数(18)但行数不同(139 vs 70)。我是否对这两个数据帧使用了正确的相关性测试?我做错了什么?

error-handling rstudio correlation
© www.soinside.com 2019 - 2024. All rights reserved.