How to write your own ggplot2 functions in R


Tidyverse packages like ggplot2 and dplyr have a function syntax that is usually pretty handy: You don’t have to put column names in quotation marks. For example: 

dplyr::filter(mtcars, mpg > 30)

Note the column name, mpg, is unquoted.

That feature hasn’t been handy, though, if you want to write your own R functions using the tidyverse. That’s because base R functions usually need quoted column names while tidyverse functions generally don’t.