## ----setup, include = FALSE--------------------------------------
library(ggplot2)

## ----output------------------------------------------------------
x <- c(4.2, 5.1, 6.3, 5.8)
summary(x)

## ----warning, warning = TRUE-------------------------------------
as.integer("seven")

## ----mpg, fig.cap = "Heavier cars travel fewer miles per gallon."----
ggplot(mtcars, aes(wt, mpg, colour = factor(cyl))) +
  geom_point(size = 2.4) +
  albersdown::scale_color_albers() +
  labs(x = "Weight (1000 lbs)", y = "Miles per gallon", colour = "Cylinders")

## ----table-------------------------------------------------------
knitr::kable(
  aggregate(cbind(mpg, hp) ~ cyl, data = mtcars, FUN = mean),
  digits = 1,
  caption = "Mean fuel efficiency and power by cylinder count."
)

