我阅读了这个和那个Stack Overflow的问题,但仍然无法解决我的问题。我有一个数据表,其中只包含我的总数据表的几列和行。
library(data.table)
structure(list(Patient = c("MB108", "MB108", "MB108", "MB108",
"MB108", "MB108", "MB108", "MB108", "MB108", "MB108"), Visit = c(1,
1, 1, 1, 9, 9, 9, 9, 12, 12), Stimulation = c("NC", "SEB", "PPD",
"E6C10", "NC", "SEB", "PPD", "E6C10", "NC", "SEB"), `CD38 ` = c(83.3,
63.4, 83.2, 91.5, 90.9, 70.9, 71, 88.4, 41.7, 47.9)), .Names = c("Patient",
"Visit", "Stimulation", "CD38 "), class = c("data.table", "data.frame"
), row.names = c(NA, -10L), .internal.selfref = <pointer: 0x102806578>)
当visit为1和9时,我想对第4列进行t.test。我检查了NAs以及两列的长度。
谢谢任何帮助!
#na.omit(boolean_dt3)
#print(length(unlist(boolean_dt3[Visit== 1,4, with = FALSE])))
#print(length(unlist(boolean_dt3[Visit== 9,4, with = FALSE])))
wilcox.test( unlist(boolean_dt3[Visit== 1,4, with = FALSE])~ unlist(boolean_dt3[Visit== 9,4, with = FALSE]) , paired = T, correct=FALSE)