Created
October 18, 2022 17:59
-
-
Save MCMaurer/0d303a1062c87c97eaa865f4097eba22 to your computer and use it in GitHub Desktop.
combining distinct values from a column where rows are otherwise duplicates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
tibble(group = c("A", "A", "B", "C"), | |
major = c("bio", "chem", "bio", "art")) %>% | |
group_by(group) %>% | |
summarise(major = str_c(major, collapse = "/")) %>% | |
separate(major, into = c("major1", "major2"), sep = "/") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment