if (FALSE) {
require("magrittr")
# Load data
data("ToothGrowth")
df <- ToothGrowth
df$dose <- as.factor(df$dose)
# Box plot
bxp <- ggboxplot(df, x = "dose", y = "len",
color = "dose", palette = "jco")
# Dot plot
dp <- ggdotplot(df, x = "dose", y = "len",
color = "dose", palette = "jco")
# Density plot
dens <- ggdensity(df, x = "len", fill = "dose", palette = "jco")
# Export to pdf
ggarrange(bxp, dp, dens, ncol = 2) %>%
ggexport(filename = "test.pdf")
# Export to png
ggarrange(bxp, dp, dens, ncol = 2) %>%
ggexport(filename = "test.png")
}
Run the code above in your browser using DataLab