Handling a missing string value to a function when using group_by in dplyr
问题 I'm looking to create a function that can take multiple string inputs (2 in this example), and using group_by, return results even if only one string is input. I know I could create if statements to get around the case when only one string is passed to the function, but is there a better way for group_by to still produce output without building in conditional language (i.e., gets more cumbersome with multiple inputs). Reproducible example library(dplyr) # Create simple function car_fx <-