Notes: setting up my R environment by loading the tidyverse and palmer penguins packages
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✓ ggplot2 3.3.5 ✓ purrr 0.3.4
## ✓ tibble 3.1.6 ✓ dplyr 1.0.7
## ✓ tidyr 1.1.4 ✓ stringr 1.4.0
## ✓ readr 2.1.1 ✓ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(palmerpenguins)
Here we will go through a series of visualizations
Here, we plot flipper length against body mass
ggplot(data = penguins, aes(x=flipper_length_mm, y=body_mass_g)) +
geom_point(color="purple")
## Warning: Removed 2 rows containing missing values (geom_point).
Here, we plot flipper length against body mass and look at the breakdown by species
ggplot(data = penguins, aes(x=flipper_length_mm, y=body_mass_g)) +
geom_point(aes(shape=species))
## Warning: Removed 2 rows containing missing values (geom_point).
Here, we plot flipper length against body mass and look at the breakdown by species and sex
ggplot(data = penguins, aes(x=flipper_length_mm, y=body_mass_g)) +
geom_point(aes(color=species,
shape=species)) +
facet_wrap(~sex)
## Warning: Removed 2 rows containing missing values (geom_point).