set.seed(10311993)
library(tidyverse)
library(psych)
library(palmerpenguins)
data <- palmerpenguins::penguins %>% dplyr::select(island,body_mass_g) %>%
dplyr::filter(island == "Biscoe" | island == "Dream") %>% na.omit()
data <- droplevels(data)- 1
-
Take the
palmerpenguinsdata set and use theselectfunction to isolate the island and body_mass_g variables - 2
-
Use the
filter()function to select for only observations where the island variable is “Biscoe” or “Dream” and omit any missing data after using thena.omit()function. - 3
-
Use the
droplevels()function to ensure factor levels no longer present are excluded from analysis.