How to write your own ggplot2 functions in R

You no longer have to worry about quoted and unquoted column names when using ggplot2, thanks to the latest version of the rlang package

How to write your own ggplot2 functions in R
Thinkstock

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.

To continue reading this article register now

How to choose a low-code development platform