recall

references:
- ISI, exploration 9.2, p.494

library(tidyverse)
library(knitr)

simulation

data

diets <- read.delim("Diets.txt", header = TRUE)
str(diets)
## 'data.frame':    311 obs. of  2 variables:
##  $ Diet: Factor w/ 4 levels "Atkins","LEARN",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ BMI : num  0.1 -1 -5.4 -6.2 -4.1 -1.7 3.4 -1.1 -7.7 0.5 ...
tbl <- diets %>%
  group_by(Diet) %>%
  summarize(mean = mean(BMI),
            s = sd(BMI),
            n = n())
kable(tbl)
Diet mean s n
Atkins -1.6506494 2.541634 77
LEARN -0.9215190 2.002277 79
Ornish -0.7697368 2.137788 76
Zone -0.5303797 2.000920 79

Barplot.

ggplot(tbl, aes(x = Diet, y = mean, fill = Diet)) +
  geom_bar(stat = "identity") +
  scale_fill_manual(values = c("azure", "bisque", "skyblue", "orchid")) +
  labs(title = "Change in BMI")