Closed jmicrobe closed 2 years ago
Hi,
Use:
my_comparisons <- list(c("5", "20"), c("5", "10"), c("10", "20"))
instead of:
my_comparisons <- list(c("5, 20"), c("5, 10"), c("10, 20"))
@kassambara of course it was a simple typo. That worked great, thank you. Can't wait to use this package more!
This is my data
ID | Period | Tra |
---|---|---|
2 | O | 33.81648475 |
4 | O | 46.0599032 |
7 | O | 39.24617467 |
15 | O | 34.30622148 |
21 | O | 42.71691764 |
23 | O | 38.99065985 |
24 | O | 48.87056621 |
51 | O | 41.14124291 |
55 | O | 39.86366882 |
57 | O | 34.41268599 |
72 | I | 40.86443519 |
93 | I | 40.01271913 |
94 | I | 38.52221601 |
97 | I | 40.60892037 |
128 | I | 34.41268599 |
129 | I | 36.41421875 |
141 | I | 39.73591141 |
148 | I | 37.64920704 |
151 | I | 34.90242273 |
166 | I | 39.13971016 |
179 | M | 45.46370195 |
180 | M | 40.43857716 |
181 | M | 49.55193907 |
183 | M | 44.05837044 |
184 | M | 47.89109274 |
185 | M | 46.37929672 |
188 | M | 51.10632089 |
189 | M | 36.52068326 |
198 | M | 45.37853034 |
200 | M | 41.52451514 |
I am trying to add the pvalues on a boxplot and I always get the same error. I have tried different methods but I always get the same error.
my_comparisons <- list( c("O M"), c("O I"), c("I M") ) ggboxplot(newdata, x = "Period", y = "tra", color = "Period", palette = "jco",add="jitter")+ stat_compare_means(comparisons = my_comparisons,method = "anova")+ # Add global p-value stat_compare_means(aes(label = ..p.signif..), method = "t.test", ref.group = "0.5")
ggboxplot(newdata, x = "Period", y = "tra", color = "Period", palette = "npg")+ stat_compare_means(method = "anova", label.y = 50)+ # Add global p-value stat_compare_means(aes(label = ..p.signif..), method = "t.test", ref.group = "0.5")
ALWAYS THE SAME ERROR and I don´t see the starts or the pvalues on the plot
2: Computation failed in stat_compare_means()
:
missing value where TRUE/FALSE needed
Any suggestions?
THANKS,
How to add comparissons between treatments for heach gene expression? i mean, a want to add p-value and brackets for each gene (GATA3, PTEN, XBP1) but comparing BRCA to OV and BRCA to LUSC for each gene like this:
my_comparisons <- list(c("BRCA", "OV"), c("OV", "LUSC"))
ggboxplot(expr, x = "dataset", y = "GATA3", title = "GATA3", ylab = "Expression", color = "dataset", palette = "jco")+ stat_compare_means(comparisons = my_comparisons)
but doing this:
ggboxplot(expr, x = "dataset", y = c("GATA3", "PTEN", "XBP1"), merge = "flip", ylab = "Expression", palette = "jco")
thank you
Why is this closed? I was interested in the same, and I cannot get it to work
same question......
Are you looking for something like this:
library(ggpubr)
bxp <- ggboxplot(gene_expression, x = "dataset",
y = c("GATA3", "PTEN", "XBP1"),
merge = "flip",
ylab = "Expression",
palette = "jco")
bxp +
geom_pwc(
aes(group = dataset), tip.length = 0,
method = "wilcox_test", label = "p.adj.format",
bracket.nudge.y = -0.08
) +
scale_y_continuous(expand = expansion(mult = c(0, 0.1)))
The following docs might help:
Please, consider installing the latest dev version of ggpubr using devtools::install_github("kassambara/ggpubr")
Great package! I'm trying to apply it to a relatively small data set that I have and I'm getting an error when trying to add significance data to the plot.
Running
yields a 6 x 8 tibble with some of the significance data I'm hoping to add to my plot:
Following the example given in the docs for adding p-values comparing groups:
I get the following errors:
I've tried several different arguments in
stat_compare_means()
without success. I'm hoping to achieve something similar to the example plot below (or just the output of "p.signif" instead of a value):