首页 > 其他分享 >R语言:wilcox_test 出现报错 Can't extract columns that don't exist. x Column doesn't exist.

R语言:wilcox_test 出现报错 Can't extract columns that don't exist. x Column doesn't exist.

时间:2023-02-21 14:33:23浏览次数:43  
标签:stat wilcox 报错 test exist colnames

运行以下命令时:

stat.test <- all %>% 
    wilcox_test(colnames(all)[1] ~ colnames(all)[2]) %>%
    adjust_pvalue(method ="BH") %>% 
    add_significance("p.adj")
stat.test 

出现报错:

Error in vec_as_location2_result():
! Can't extract columns that don't exist.
x Column colnames(all)[1] doesn't exist.

解决方案:

stat.test <- all %>% 
    wilcox_test(as.formula(paste(colnames(all)[1], colnames(all)[2], sep = "~"))) %>%
    adjust_pvalue(method ="BH") %>% 
    add_significance("p.adj")
stat.test 

标签:stat,wilcox,报错,test,exist,colnames
From: https://www.cnblogs.com/chenwenyan/p/17140929.html

相关文章