sah*_*uno 0 r tidy dplyr rstatix
我有包含两组的数据数据框:肿瘤组和正常组。对于每个站点/行,我想计算费舍尔精确值以用于Methyl UnMethy之间的使用Tumor and Normal
我正在寻找如何使用 dplyr 方法转换数据以计算每个站点的渔民精确度。
methyl_dat <- data.frame(loci = c("site1", "site2", "site3", "site4"),
Methy.tumor = c(50, 5, 60, 12),
UnMethy.tumor = c(60, 0, 65, 5),
Methy.Normal = c(13, 5, 22, 3),
UnMethy.Normal = c(86, 0, 35, 3) )
Run Code Online (Sandbox Code Playgroud)
这是 Fischer 对站点 1 的精确策略
Normal
Tumor Methyl UnMethy
Methy 50 13
UnMethy 60 86
Run Code Online (Sandbox Code Playgroud)
考虑这样做:
apply(methyl_dat[-1], 1, \(x)fisher.test(matrix(x,2)), simplify = F)
Run Code Online (Sandbox Code Playgroud)