Weight gain in rats
weight.Rd
The data come from an experiment to study the gain in weight of rats fed on four different diets, distinguished by amount of protein (low and high) and by source of protein (beef and cereal). The design of the experiment is completely randomized with ten rats on each of the four treatments (which have a complete factorial structure).
Format
A data frame with 30 rows and 3 columns:
- weight
Weight gain in grams
- source
Protein source (`beef` or `cereal`)
- amount
Protein amount (`low` or `high`)
Source
Snedecor, G.W. and Cochran, G.C. (1967) Statistical Methods, 6th edition, Ames, Iowa: Iowa State University Press, 347.
Examples
library(hsds)
library(ggplot2)
#> Error in library(ggplot2): there is no package called ‘ggplot2’
# Mean weight gain per diet
weight %>%
dplyr::summarise(
mean(weight),
sd(weight),
.by = c(source, amount)
)
#> Error in weight %>% dplyr::summarise(mean(weight), sd(weight), .by = c(source, amount)): could not find function "%>%"
# Colored box plot
ggplot(weight, aes(x = amount, y = weight, color = source)) +
geom_boxplot() +
geom_jitter(position = position_dodge(width = 0.75)) +
theme_classic()
#> Error in ggplot(weight, aes(x = amount, y = weight, color = source)): could not find function "ggplot"
# Two-way ANOVA
aov(weight ~ amount * source, data = weight) %>%
summary()
#> Error in aov(weight ~ amount * source, data = weight) %>% summary(): could not find function "%>%"