Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to show the result of compare_means() in the stat_compare_means() #602

Open
LiZhihua1982 opened this issue May 5, 2024 · 0 comments

Comments

@LiZhihua1982
Copy link

Hi Everyone,
My data is below
image

compare_means(value~group2, group.by="variable",data=fm,method = "kruskal.test")

A tibble: 12 × 7

variable .y. p p.adj p.format p.signif method

1 Tyramine value 0.000349 0.0042 0.00035 *** Kruskal-Wallis
2 Cadaverine value 0.000349 0.0042 0.00035 *** Kruskal-Wallis
3 Histamine value 0.0243 0.097 0.02434 * Kruskal-Wallis
4 Putrescine value 0.508 0.8 0.50780 ns Kruskal-Wallis
5 Ornithine value 0.000349 0.0042 0.00035 *** Kruskal-Wallis
6 Tryptamine value 0.0193 0.096 0.01928 * Kruskal-Wallis
7 Spermidine value 0.0380 0.11 0.03798 * Kruskal-Wallis
8 Phenethylamine value 0.00232 0.016 0.00232 ** Kruskal-Wallis
9 X3.Methoxytyramine value 0.00232 0.016 0.00232 ** Kruskal-Wallis
10 Ethanolamine value 0.000675 0.0061 0.00067 *** Kruskal-Wallis
11 Spermine value 0.402 0.8 0.40154 ns Kruskal-Wallis
12 Agmatine value 0.00127 0.01 0.00127 ** Kruskal-Wallis
.............

when I use this order :p <- ggline(fm, x = "time", y = "value", color = "group2",
shape = 21,point.size =2,stroke =1,
add = c("mean_sd", "jitter"),
xlab = 'Days',ylab = 'value',
palette = c("#f94040", "#0000ff"),
facet.by=c("variable"))+theme_set(theme_bw())
image

when I use this order
p2<- p+stat_compare_means(aes(group = group2),method = "kruskal.test",label = "p.signif",size=2.8,label.x = 1.4,label.y = 8000000)
image

When I use this order: p+stat_compare_means(), it shows the comparsion with different "time" not the "group2"
image

So, As shown in compare_means(), Tyramine is significant which I want to show it in the stat_compare_means(),I don't know how to change the order, would you help me? Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant