# \donttest{
# Load the dataset
data(dormouse_hibernation)
# Basic exploration
head(dormouse_hibernation)
summary(dormouse_hibernation)
# Examine hibernation duration by age
boxplot(hibernation_duration ~ age, data = dormouse_hibernation,
main = "Hibernation Duration by Age",
xlab = "Age (years)", ylab = "Duration (days)")
# Compare body mass change during hibernation
with(dormouse_hibernation,
plot(body_mass_before, body_mass_after,
col = as.integer(sex),
main = "Body Mass Before vs After Hibernation",
xlab = "Body Mass Before (g)",
ylab = "Body Mass After (g)"))
legend("topleft", levels(dormouse_hibernation$sex),
col = 1:2, pch = 1)
# Examine reproductive activity by age
with(subset(dormouse_hibernation, !is.na(repro_active)),
table(age, repro_active))
# }
Run the code above in your browser using DataLab