Notes: Setting up my R environment by loading the ‘tidyverse’ and ‘palmerpenguins’ packages
library(tidyverse)
## Warning: package 'dplyr' was built under R version 4.3.3
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.4.4 ✔ tibble 3.2.1
## ✔ lubridate 1.9.3 ✔ tidyr 1.3.1
## ✔ purrr 1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(palmerpenguins)
library(ggplot2)
library(palmerpenguins)
data(penguins)
View(penguins)
Here we will go through a series of visualizations
Here, we plot flipper length against body mass
ggplot(data = penguins) +
geom_point(mapping = aes(x = flipper_length_mm, y = body_mass_g, 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) +
geom_point(mapping = aes(x = flipper_length_mm, y = body_mass_g, color = species, shape = species))
## Warning: Removed 2 rows containing missing values (`geom_point()`).
ggplot(data = penguins) +
geom_point(mapping = aes(x = flipper_length_mm, y = body_mass_g, color = species, shape = species)) +
facet_wrap(~sex)
## Warning: Removed 2 rows containing missing values (`geom_point()`).