library(ggplot2)
library(tidyr)
# All births
ggplot(arbuthnot, aes(x = year, y = boys + girls, group = 1)) +
geom_line()
# Boys and girls
arbuthnot %>%
pivot_longer(cols = -year, names_to = "sex", values_to = "n") %>%
ggplot(aes(x = year, y = n, color = sex, group = sex)) +
geom_line()
Run the code above in your browser using DataLab