Setting up my environment

Notes: setting up my R environment by loading the ‘tidyverse’ and ‘palmer penguins’ packages

library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ──
## ✔ ggplot2 3.4.0      ✔ purrr   0.3.5 
## ✔ tibble  3.1.8      ✔ dplyr   1.0.10
## ✔ tidyr   1.2.1      ✔ stringr 1.5.0 
## ✔ readr   2.1.3      ✔ forcats 0.5.2 
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
library(palmerpenguins)
data("penguins")
view(penguins)

Creating graph for flipper length vs. body mass

Here, I used the ggplot function to create a scatter plot that plots flipper length of all three species versus the body mass in grams.

ggplot(data = penguins)+
  geom_point(mapping = aes(x = flipper_length_mm, y = body_mass_g, color = species))+
  labs(title = "Flipper Length vs Body Mass", subtitle = "Survival of the fittest", x = "Flipper length (mm)", y = "Body mass (g)" )