Programmatically calling group_by() on a varying variable
The underscore functions of dplyr could be useful for that:
ChickWeight %>% group_by_( "Chick", v ) %>% summarise( mw = mean( weight ) )
From the new features in dplyr 0.3:
You can now program with dplyr – every function that uses non-standard evaluation (NSE) also has a standard evaluation (SE) twin that ends in _
. For example, the SE version of filter() is called filter_
(). The SE version of each function has similar arguments, but they must be explicitly “quoted”.