Last active
August 29, 2015 14:12
-
-
Save briandk/7c11e9aca5a0adc998cc to your computer and use it in GitHub Desktop.
Formatting conventions for piping with magrittr in R
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
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