I'm trying to do an one-way ANOVA using the size condition in a loop for each Compound.Name and then a TuckeyHSD and store the pvalue result in new dataframe for each permutation of the TuckeyHSD for each compound.
This post has almost what I need but its data is a crosstab table and mine is tabular, haven't been able to make it work with my data.
Could you point me in the right direction to solve this issue ?
EDIT : I've managed to almost make this worked :
read.csv(file = 'test-mev-query-size.csv', header = T)
%>% group_by(Compound.Name)
%>% do(broom::tidy(TukeyHSD(aov(Measured.Area ~ size, data = .))))
%>% ungroup
And I get the same error as the guy from the other post,
Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) :
contrasts can be applied only to factors with 2 or more levels
So I've tried to manage this issue and by mistake I've replace data =. by data = GC
GC being
GC <- read.csv(file = 'test-mev-query-size.csv', header = T)
And now I get this result :
Compound.Name term contrast null.value estimate conf.low conf.high adj.p.value
<chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
1 (3-Hydroxy-4-methoxyphenyl)ethylene glycol tris(trimethylsilyl) ether size M-L 0 -814155. -146910662. 145282352. 1.00
2 (3-Hydroxy-4-methoxyphenyl)ethylene glycol tris(trimethylsilyl) ether size p-L 0 -4956448. -207938755. 198025860. 1.00
3 (3-Hydroxy-4-methoxyphenyl)ethylene glycol tris(trimethylsilyl) ether size S-L 0 -40549091. -186767739. 105669556. 0.892
4 (3-Hydroxy-4-methoxyphenyl)ethylene glycol tris(trimethylsilyl) ether size p-M 0 -4142293. -207930562. 199645976. 1.00
5 (3-Hydroxy-4-methoxyphenyl)ethylene glycol tris(trimethylsilyl) ether size S-M 0 -39734936. -187070384. 107600511. 0.900
6 (3-Hydroxy-4-methoxyphenyl)ethylene glycol tris(trimethylsilyl) ether size S-p 0 -35592644. -239468493. 168283206. 0.970
7 ?-Alanine, 3TMS derivative size M-L 0 -814155. -146910662. 145282352. 1.00
8 ?-Alanine, 3TMS derivative size p-L 0 -4956448. -207938755. 198025860. 1.00
9 ?-Alanine, 3TMS derivative size S-L 0 -40549091. -186767739. 105669556. 0.892
10 ?-Alanine, 3TMS derivative size p-M 0 -4142293. -207930562. 199645976. 1.00
But the pvalues are the same repeating over and over regardless of the compound name.
I'm a bit lost, maybe the NA is the dataset are messing things up ?
Anything could help,
Cheers, Arzock
Orignal dataset exemple :
Compound.Name Measured.Area Name size
11 ?-Alanine, 3TMS derivative 8465634 L1 L
12 ?-Alanine, 3TMS derivative 7154676 L2 L
13 ?-Alanine, 3TMS derivative 7168933 L3 L
14 ?-Alanine, 3TMS derivative 6297177 M1 M
15 ?-Alanine, 3TMS derivative 6868877 M2 M
16 ?-Alanine, 3TMS derivative 4506282 M3 M
17 ?-Alanine, 3TMS derivative 6789789 pool p
18 ?-Alanine, 3TMS derivative 4034506 S1 S
19 ?-Alanine, 3TMS derivative 9004868 S2 S
20 ?-Alanine, 3TMS derivative 5873538 S3 S
21 ?-D-Lactose, 8TMS derivative 35787723 L1 L
22 ?-D-Lactose, 8TMS derivative 46760086 L2 L
23 ?-D-Lactose, 8TMS derivative 64378939 L3 L
24 ?-D-Lactose, 8TMS derivative 40796759 M1 M
25 ?-D-Lactose, 8TMS derivative 50012840 M2 M
26 ?-D-Lactose, 8TMS derivative 31132791 M3 M
27 ?-D-Lactose, 8TMS derivative 80753261 pool p
28 ?-D-Lactose, 8TMS derivative 104465007 S1 S
29 ?-D-Lactose, 8TMS derivative 41617794 S2 S
30 ?-D-Lactose, 8TMS derivative 49398047 S3 S
51 1-Methyladenosine,tris(trimethylsilyl) ether 277710179 L1 L
52 1-Methyladenosine,tris(trimethylsilyl) ether 351095300 L2 L
53 1-Methyladenosine,tris(trimethylsilyl) ether 173003628 L3 L
54 1-Methyladenosine,tris(trimethylsilyl) ether 267239831 M1 M
55 1-Methyladenosine,tris(trimethylsilyl) ether 230375478 M2 M
56 1-Methyladenosine,tris(trimethylsilyl) ether 177557679 M3 M
57 1-Methyladenosine,tris(trimethylsilyl) ether 268424161 pool p
58 1-Methyladenosine,tris(trimethylsilyl) ether 142731061 S1 S
59 1-Methyladenosine,tris(trimethylsilyl) ether 276833806 S2 S
60 1-Methyladenosine,tris(trimethylsilyl) ether 260643543 S3 S