rstatix icon indicating copy to clipboard operation
rstatix copied to clipboard

rstatix::anova_test() Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) : contrasts can be applied only to factors with 2 or more levels

Open wanganlin00 opened this issue 8 months ago • 0 comments

print(df,n=45)

A tibble: 45 × 4

  id Days  method                    volume

1 1 -1 PBS 19.2
2 2 -1 PBS 27.0
3 3 -1 PBS 23.4
4 4 -1 PBS 27.9
5 5 -1 PBS 29.7
6 6 -1 SLAMF6+ PD-1+ CD8+ cells 31.9
7 7 -1 SLAMF6+ PD-1+ CD8+ cells 34.5
8 8 -1 SLAMF6+ PD-1+ CD8+ cells 44.4
9 9 -1 SLAMF6+ PD-1+ CD8+ cells 29.1
10 10 -1 SLAMF6+ PD-1+ CD8+ cells 41.4
11 11 -1 SLAMF6- PD-1+ CD8+ cells 20.6
12 12 -1 SLAMF6- PD-1+ CD8+ cells 35.3
13 13 -1 SLAMF6- PD-1+ CD8+ cells 27.5
14 14 -1 SLAMF6- PD-1+ CD8+ cells 29.1
15 15 -1 SLAMF6- PD-1+ CD8+ cells 37.9
16 16 7 PBS 37.7
17 17 7 PBS 45.3
18 18 7 PBS 51.9
19 19 7 PBS 22.6
20 20 7 PBS 17.5
21 21 7 SLAMF6+ PD-1+ CD8+ cells 6.74
22 22 7 SLAMF6+ PD-1+ CD8+ cells 13.1
23 23 7 SLAMF6+ PD-1+ CD8+ cells 7.23
24 24 7 SLAMF6+ PD-1+ CD8+ cells 4.27
25 25 7 SLAMF6+ PD-1+ CD8+ cells 9.86
26 26 7 SLAMF6- PD-1+ CD8+ cells 27.1
27 27 7 SLAMF6- PD-1+ CD8+ cells 44.7
28 28 7 SLAMF6- PD-1+ CD8+ cells 28.5
29 29 7 SLAMF6- PD-1+ CD8+ cells 22.6
30 30 7 SLAMF6- PD-1+ CD8+ cells 30.7
31 31 14 PBS 61.5
32 32 14 PBS 47.0
33 33 14 PBS 72.0
34 34 14 PBS 31.8
35 35 14 PBS 26.9
36 36 14 SLAMF6+ PD-1+ CD8+ cells 6.35
37 37 14 SLAMF6+ PD-1+ CD8+ cells 2.33
38 38 14 SLAMF6+ PD-1+ CD8+ cells 3.32
39 39 14 SLAMF6+ PD-1+ CD8+ cells 2.36
40 40 14 SLAMF6+ PD-1+ CD8+ cells 0.0301 41 41 14 SLAMF6- PD-1+ CD8+ cells 53.5
42 42 14 SLAMF6- PD-1+ CD8+ cells 41.7
43 43 14 SLAMF6- PD-1+ CD8+ cells 34.5
44 44 14 SLAMF6- PD-1+ CD8+ cells 25.1
45 45 14 SLAMF6- PD-1+ CD8+ cells 34.3

model <- anova_test(data = df,dv=volume,wid=id,within = Days,between = method) Error in contrasts<-(*tmp*, value = contr.funs[1 + isOF[nn]]) : contrasts can be applied only to factors with 2 or more levels levels(df$Days) [1] "-1" "7" "14" levels(df$method) [1] "PBS" "SLAMF6+ PD-1+ CD8+ cells" "SLAMF6- PD-1+ CD8+ cells" model <-rstatix::anova_test(data = df,dv=volume,wid=id,within = Days,between = method) Error in contrasts<-(*tmp*, value = contr.funs[1 + isOF[nn]]) : contrasts can be applied only to factors with 2 or more levels

wanganlin00 avatar Jun 10 '24 12:06 wanganlin00