## ungrouped plot
p <- w.ggbetweenstats(iris, "Sepal.Length")
if (FALSE) print(p)
## grouped plot
p <- w.ggbetweenstats(iris, "Sepal.Length", groupby = "Species",
bf.message = FALSE, pairwise.display = "none")
if (FALSE) print(p)
## grouped plot with p value annotation for >2 groups
pval <- anova(lm(Sepal.Length ~ Species, data = iris))['Species', 'Pr(>F)']
pval <- descutils::prettyPvalues(pval, digits = 3, orgbold = FALSE, lhs = "p")
ldat <- data.frame(`p value` = pval, check.names = FALSE)
p <- w.ggbetweenstats(iris, "Sepal.Length", groupby = "Species", pval.display = TRUE, ldat = ldat,
bf.message = FALSE, pairwise.display = "none")
if (FALSE) print(p)
## setup simple data with only two groups
iris2 <- iris[iris$Species %in% c("setosa", "virginica"),]
## grouped plot with p value annotation for two groups
pval <- t.test(Sepal.Length ~ Species, data = iris2)$p.value
pval <- descutils::prettyPvalues(pval, digits = 3, orgbold = FALSE, lhs = "p")
ldat <- data.frame(`p value` = pval, check.names = FALSE)
p <- w.ggbetweenstats(iris2, "Sepal.Length", groupby = "Species", pval.display = TRUE, ldat = ldat,
bf.message = FALSE, pairwise.display = "none")
if (FALSE) print(p)
Run the code above in your browser using DataLab