R:wilcoxon测试错误:分组因子必须正好有2个级别

Riv*_*vka 2 statistics compiler-errors r

我读了这个问题那个,但仍然无法解决我的问题.我有以下data.table,其中只包含我的data.table的总列和行的几个.

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>)
Run Code Online (Sandbox Code Playgroud)

我想在第4列进行t.test,当访问时为1,访问时为9.我检查了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)
Run Code Online (Sandbox Code Playgroud)

Riv*_*vka 5

我只是想出来,而不是~为我的问题工作.