by _Wintermute · 9y ago · 0 comments
The example:
join_and_summarize <- function(df, colour_df){
left_join(df, colour_df, by = "cyl") %>%
group_by(colour) %>%
summarize(mean_displacement = mean(disp))
}
Will go really badly wrong if someone following the tutorial simply replaces the `disp` with a function argument.Also it's often not as simple as just prefixing an underscore, you end up reading the lazyeval vignette and messing about with quote() and formula syntax.
cols <- c("colA", "colB")
dataframe[, cols]