set.seed(10311993)
library(tidyverse)
library(psych)
library(palmerpenguins)
<- palmerpenguins::penguins %>% dplyr::select(island,body_mass_g) %>%
data ::filter(island == "Biscoe" | island == "Dream") %>% na.omit()
dplyr
<- droplevels(data) data
- 1
-
Take the
palmerpenguins
data set and use theselect
function 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.