knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "75%", warning = FALSE, message = FALSE, fig.retina = 2, fig.align = 'center' ) library(tidyverse) library(palmerpenguins)
The goal of palmerpenguins is to provide a great dataset for data exploration & visualization, as an alternative to iris
.
flipper_bill <- ggplot(data = penguins, aes(x = flipper_length_mm, y = bill_length_mm)) + geom_point(aes(color = species, shape = species), size = 3, alpha = 0.8) + geom_smooth(method = "lm", se = FALSE, aes(color = species)) + theme_minimal() + scale_color_manual(values = c("darkorange","purple","cyan4")) + labs(title = "Flipper and bill length", subtitle = "Dimensions for Adelie, Chinstrap and Gentoo Penguins at Palmer Station LTER", x = "Flipper length (mm)", y = "Bill length (mm)", color = "Penguin species", shape = "Penguin species") + theme(legend.position = c(0.85, 0.15), plot.title.position = "plot", plot.caption = element_text(hjust = 0, face= "italic"), plot.caption.position = "plot") flipper_bill
You can install the released version of palmerpenguins from CRAN with:
install.packages("palmerpenguins")
To install the development version from GitHub use:
# install.packages("remotes") remotes::install_github("allisonhorst/palmerpenguins")
Data were collected and made available by Dr. Kristen Gorman and the Palmer Station, Antarctica LTER, a member of the Long Term Ecological Research Network.
The palmerpenguins package contains two datasets.
library(palmerpenguins) data(package = 'palmerpenguins')
One is called penguins
, and is a simplified version of the raw data; see ?penguins
for more info:
head(penguins)
The second dataset is penguins_raw
, and contains all the variables and original names as downloaded; see ?penguins_raw
for more info.
head(penguins_raw)
Both datasets contain data for r nrow(penguins)
penguins. There are r length(unique(penguins$species))
different species of penguins in this dataset, collected from r length(unique(penguins$island))
islands in the Palmer Archipelago, Antarctica.
str(penguins)
We gratefully acknowledge Palmer Station LTER and the US LTER Network. Special thanks to Marty Downs (Director, LTER Network Office) for help regarding the data license & use.
You can find these and more code examples for exploring palmerpenguins in vignette("examples")
.
Penguins are fun to summarize! For example:
library(tidyverse) penguins %>% count(species) penguins %>% group_by(species) %>% summarize(across(where(is.numeric), mean, na.rm = TRUE))
Penguins are fun to visualize! For example:
mass_flipper <- ggplot(data = penguins, aes(x = flipper_length_mm, y = body_mass_g)) + geom_point(aes(color = species, shape = species), size = 3, alpha = 0.8) + theme_minimal() + scale_color_manual(values = c("darkorange","purple","cyan4")) + labs(title = "Penguin size, Palmer Station LTER", subtitle = "Flipper length and body mass for Adelie, Chinstrap, and Gentoo Penguins", x = "Flipper length (mm)", y = "Body mass (g)", color = "Penguin species", shape = "Penguin species") + theme(legend.position = c(0.2, 0.7), plot.title.position = "plot", plot.caption = element_text(hjust = 0, face= "italic"), plot.caption.position = "plot") mass_flipper
flipper_hist <- ggplot(data = penguins, aes(x = flipper_length_mm)) + geom_histogram(aes(fill = species), alpha = 0.5, position = "identity") + scale_fill_manual(values = c("darkorange","purple","cyan4")) + theme_minimal() + labs(x = "Flipper length (mm)", y = "Frequency", title = "Penguin flipper lengths") flipper_hist
You can download palmerpenguins art (useful for teaching with the data) in vignette("art")
. If you use this artwork, please cite with: "Artwork by @allison_horst".
knitr::include_graphics("man/figures/lter_penguins.png", dpi = 300)
The culmen is the upper ridge of a bird's bill. In the simplified penguins
data, culmen length and depth are renamed as variables bill_length_mm
and bill_depth_mm
to be more intuitive.
For this penguin data, the culmen (bill) length and depth are measured as shown below (thanks Kristen Gorman for clarifying!):
knitr::include_graphics("man/figures/culmen_depth.png", dpi = 300)
Data are available by CC-0 license in accordance with the Palmer Station LTER Data Policy and the LTER Data Access Policy for Type I data.
To cite the palmerpenguins package, please use:
citation("palmerpenguins")
Anyone interested in publishing the data should contact Dr. Kristen Gorman about analysis and working together on any final products. From Gorman et al. (2014): "Individuals interested in using these data are expected to follow the US LTER Network’s Data Access Policy, Requirements and Use Agreement: https://lternet.edu/data-access-policy/."
Data originally published in:
Data citations:
Adélie penguins:
Gentoo penguins:
Chinstrap penguins:
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.