Implementing a circular barplot in R
The R code you will find in this section is inspired by the code shared with the entire R community by the R Graph Gallery website (https://www.r-graph-gallery.com/index.html). In addition to a few very small additions, we refactored and generalized the code into the circular_grouped_barplot()
function using the tidy evaluation
framework (check the references for further details) so that it can be used with any dataset.
If you remember correctly, in R functions you saw in previous chapters, you passed column names to functions as strings. Thanks to tidy evaluation
, you can pass them to functions using tidyverse grammar, that is, passing them directly through a pipeline. Take the following example:
circular_grouped_barplot(data = speakers_tbl, grp_col_name = 'Characteristics', ...