-
Notifications
You must be signed in to change notification settings - Fork 21
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
hide.NS option for add_pvalue function #7
Comments
Hi there. I left out this option on purpose as it assumed that your significance level would always be 0.05, which might not always be the case. I felt it was better to just filter out the non-significant rows from the p-value data.frame before plotting, as below: library(ggplot2)
library(ggprism)
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
df_p_val <- ToothGrowth %>%
rstatix::group_by(dose) %>%
rstatix::t_test(len ~ supp) %>%
rstatix::adjust_pvalue(p.col = "p", method = "bonferroni") %>%
rstatix::add_significance(p.col = "p.adj") %>%
rstatix::add_xy_position(x = "dose", dodge = 0.8) %>%
filter(p.adj < 0.01) # here we have chosen an alpha of 0.01
p <- ggplot(ToothGrowth, aes(x = factor(dose), y = len)) +
geom_boxplot(aes(fill = supp)) +
theme_prism() +
coord_cartesian(ylim = c(0, 40))
p + add_pvalue(df_p_val,
xmin = "xmin",
xmax = "xmax",
label = "p = {p.adj}",
tip.length = 0) Created on 2021-04-05 by the reprex package (v1.0.0) |
I can see why you left it out. In my use case, I am using add_pvalue as part of a function in which I am providing custom If I filter the p-values it creates errors regarding vector lengths and I will try to provide a MWE if required. |
Yes a MWE would be helpful :) I expect there is a mismatch between the length of As a side note, looking at the source for |
Hi! I'm trying to use your method to filter out the ns values, but I received an error: |
This is an option in stat_pvalue_manual to hide insignificant p values from being plotted and seems to be missing from add_pvalue function. Would you be able to add it?
The text was updated successfully, but these errors were encountered: