Skip to content

Instantly share code, notes, and snippets.

@briandk
Last active Aug 29, 2015
Embed
What would you like to do?
Formatting conventions for piping with magrittr in R
df <-
  df %>%
  select(col1 = str_split(oldcol2, ','),
         col2,
         col3 = paste0(oldcol1, 'amber')) %>%
  filter(col1 == "America" | col2 >= 55) %>%
  group_by(col1, col2) %>%
  summerize(count = n())
df <-
  df %>%
  select(col1, col2, col3 = paste0(oldcol1, 'amber')) %>%
  filter(col1 == "America" | col2 >= 55) %>%
  group_by(col1, col2) %>%
  summerize(count = n())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment