Note: setting up my environment by loading the ‘tidyverse’ and ‘palmerpenguins’ packages
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ──
## ✔ ggplot2 3.4.1 ✔ purrr 1.0.1
## ✔ tibble 3.1.8 ✔ dplyr 1.1.0
## ✔ tidyr 1.3.0 ✔ stringr 1.5.0
## ✔ readr 2.1.3 ✔ forcats 1.0.0
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
library(palmerpenguins)
here we wiil go through a series of visualizations
Here, we will 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 will 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 will 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()`).