Skip to content

Instantly share code, notes, and snippets.

@jhollist
Created June 22, 2017 11:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jhollist/b0e6fa3f69d7c9e81bf6e079f94089ec to your computer and use it in GitHub Desktop.
Save jhollist/b0e6fa3f69d7c9e81bf6e079f94089ec to your computer and use it in GitHub Desktop.
library(dplyr)
iris2 <- iris %>%
mutate(sp_abbr = case_when(Species == "virginica" ~ "vir",
Species == "setosa" ~ "set",
Species == "versicolor" ~ "vers"))
iris2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment