Last active
March 2, 2018 22:57
-
-
Save cecilialee/61bec00ba4ed0406186a6f982d12cdca to your computer and use it in GitHub Desktop.
Separate one column into multiple columns in R. #r #tidyr
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(tidyr) | |
library(dplyr) | |
df <- data.frame(x = c(NA, "a|b", "a|d", "b|c")) | |
df %>% separate(x, c("word1", "word2")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment