knitr::opts_chunk$set(echo = TRUE) library(Hmisc) library(MASS) library(tidyverse) library(biostat) library(ggridges)
hist(sort(rnorm(1e5)))
Sitka
Sitka89
SP500
Traffic %>% glimpse()
glimpse(UScereal)
psych::describe(UScereal) %>% pander::pander()
mad(UScereal$calories)
ggplot(anorexia, aes(x = Prewt, y = Postwt, color = Treat)) + geom_point() + geom_smooth(method = "lm", se = FALSE)
anorexia2 <- anorexia %>% mutate(diff_wt = Postwt - Prewt) ggplot(anorexia2, aes(x = Treat, y = diff_wt)) + geom_boxplot()
ggplot(anorexia2, aes(x = Treat, y = diff_wt, color = Treat)) + geom_violin() + geom_jitter(width = .1) + coord_flip()
ggplot(anorexia2, aes(x = diff_wt, fill = Treat)) + geom_density(alpha = 0.3, adjust = 1.6) + coord_flip()
ggplot(anorexia2, aes(x = diff_wt, y = Treat, fill = Treat)) + geom_density_ridges(alpha = 0.3, scale = 0.9, bandwidth = 5)
ggplot(anorexia2, aes(x = diff_wt, fill = Treat)) + geom_density(alpha = 0.3, adjust = 1.6) + coord_flip()
anorexia3 <- anorexia %>% mutate(id = row_number()) %>% gather(key = "time", value = "weight", Prewt, Postwt) %>% separate(col = time, into = c("time", "del"), sep = -2) %>% select(-del) %>% mutate(time = fct_relevel(time, "Pre", "Post")) ggplot(anorexia3, aes(x = time, y = weight, group = id)) + geom_line() + geom_point(color = "orange") + facet_grid(. ~ Treat)
qq_plot(diff_wt ~ Treat, data = anorexia2) biostat::test_normality(diff_wt ~ Treat, data = anorexia2) PMCMR::posthoc.kruskal.conover.test(diff_wt ~ Treat, data = anorexia2) %>% make_cld()
Bin Freq Cum_freq Percent Cum_percent
4.3 -- 5.0 32 32 21.3 % 21.3 % 5.0 -- 5.7 41 73 27.3 % 48.7 % 5.7 -- 6.5 42 115 28.0 % 76.7 % 6.5 -- 7.2 24 139 16.0 % 92.7 % 7.2 -- 7.9 11 150 7.3 % 100.0 %
Table: Frequency table
| Bin | Freq | Cum_freq | Percent | Cum_percent | |:----------:|-----:|---------:|--------:|------------:| | 4.3 -- 5.0 | 32 | 32 | 21.3 % | 21.3 % | | 5.0 -- 5.7 | 41 | 73 | 27.3 % | 48.7 % | | 5.7 -- 6.5 | 42 | 115 | 28.0 % | 76.7 % | | 6.5 -- 7.2 | 24 | 139 | 16.0 % | 92.7 % | | 7.2 -- 7.9 | 11 | 150 | 7.3 % | 100.0 % |
Table: Frequency table
Bin Freq Cum_freq Percent Cum_percent
4.3 -- 5.0 32 32 21.3 % 21.3 %
5.0 -- 5.7 41 73 27.3 % 48.7 %
5.7 -- 6.5 42 115 28.0 % 76.7 %
6.5 -- 7.2 24 139 16.0 % 92.7 %
Table: Frequency table
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.