--- title: "Bill dimensions across Antarctic penguin species" author: "Your name" format: html --- ```{r} #| label: setup #| message: false library(dplyr) library(ggplot2) library(gt) library(ggokabeito) # color-blind-safe (Okabe-Ito) scale data(penguins) penguins <- penguins |> filter(!is.na(bill_len), !is.na(bill_dep)) ``` ## The data We measured **`{r} nrow(penguins)`** penguins of `{r} length(unique(penguins$species))` species (`{r} knitr::combine_words(levels(penguins$species))`), collected at Palmer Station, Antarctica. The data are available through the **palmerpenguins** package and are now also included in base R's `datasets` package. The species are not evenly represented: ```{r} #| label: counts penguins |> count(species, name = "n") |> knitr::kable() ``` ## Bill shape separates the species Within a species the bill has a characteristic shape, so the species form clusters. ```{r} #| fig-width: 5 #| warning: false ggplot(penguins, aes(bill_len, bill_dep, color = species)) + geom_point(alpha = 0.8) + labs(x = "Bill length (mm)", y = "Bill depth (mm)", color = "Species") + theme_minimal(base_size = 12) ``` ## Mean measurements ```{r} penguins |> summarise( n = n(), bill_len = mean(bill_len), bill_dep = mean(bill_dep), body_mass = mean(body_mass, na.rm = TRUE), .by = species ) |> gt() |> cols_label(species = "Species", n = "N", bill_len = "Bill length (mm)", bill_dep = "Bill depth (mm)", body_mass = "Body mass (g)") |> fmt_number(columns = c(bill_len, bill_dep), decimals = 1) |> fmt_number(columns = body_mass, decimals = 0) ``` ## Session {.appendix .unnumbered}
Session info ```{r} #| label: session sessionInfo() ```