Skip to content

Instantly share code, notes, and snippets.

@MonkmanMH
Last active October 8, 2020 16:41
Show Gist options
  • Save MonkmanMH/2e328724e4535daadf3d000dce8d235a to your computer and use it in GitHub Desktop.
Save MonkmanMH/2e328724e4535daadf3d000dce8d235a to your computer and use it in GitHub Desktop.
penguins <- palmerpenguins::penguins
penguins %>%
filter(!is.na(sex)) %>%
mutate(bm_quart = gtools::quantcut(body_mass_g, q=4))
penguins_2 <- penguins %>%
filter(!is.na(sex)) %>%
select(species, sex, body_mass_g) %>%
# mutate(bm_quart = gtools::quantcut(body_mass_g, q=4))
mutate(bm_quart = as.integer(gtools::quantcut(body_mass_g, q=4))) %>%
mutate(bm_quart = as.factor(bm_quart))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment