Created
March 30, 2019 01:27
-
-
Save chasemc/e9e70cecc2062ca4e11863544564fc55 to your computer and use it in GitHub Desktop.
boxplotRant.Rmd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| title: "Untitled" | |
| author: "Chase Clark" | |
| date: "March 29, 2019" | |
| output: html_document | |
| --- | |
| ```{r} | |
| library(ggpubr) | |
| library(ggplot2) | |
| ``` | |
| ```{r} | |
| set.seed(1) | |
| x <- c(rep("Sample_A", 20), | |
| rep("Sample_B", 20)) | |
| y <- c(rnorm(10, 15), | |
| rnorm(10, 1), | |
| rnorm(20, 15)) | |
| data <- cbind.data.frame(Sample=x,yy=y) | |
| ``` | |
| ```{r} | |
| p <- ggplot(data, | |
| aes(x = Sample, y = yy, fill = Sample)) | |
| p + geom_violin() + | |
| geom_jitter(height = 0, width = 0.1) | |
| ``` | |
| ```{r} | |
| ggbarplot(data, x = 'Sample', y = 'yy', add = "mean_se", fill="Sample")+ | |
| stat_compare_means() + | |
| stat_compare_means(ref.group = "Sample_A", label = "p.signif", | |
| label.y = c(22, 22)) | |
| ``` | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment