Created
February 24, 2017 16:26
-
-
Save aammd/e85fd9a3140d7c590de9d9c9a421d580 to your computer and use it in GitHub Desktop.
if you have species names in one column
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(dplyr) | |
library(tidyr) | |
library(stringr) | |
too_wide <- frame_data( | |
~common_name, ~plant_genera, | |
"Abagrotis apposita", "Amelanchier Arbutus Cenanothus", | |
"Abagrotis brunipennis", "Prunus Vaccinium" | |
) | |
too_wide %>% | |
mutate(plant_genera = str_split(plant_genera, " ")) %>% | |
unnest(plant_genera) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment