Implementing a circular barplot in R
In this section, you’ll find R code inspired by the code available to the entire R community at the R Graph Gallery website (https://www.r-graph-gallery.com/index.html). Along with some minor additions, we’ve refactored and generalized this code into a function called circular_grouped_barplot()
. This was done using the tidy evaluation framework (see the included references for more information). The main benefit of this change is that our function can now handle any dataset.
You may recall from previous chapters that when dealing with R functions, column names were passed to functions as strings. However, with the advent of tidy evaluation, these column names can now be passed using tidyverse grammar instead. Essentially, this allows column names to be passed directly through a pipeline. Consider the example below for a better understanding:
circular_grouped_barplot(data = speakers_tbl,
grp_col_name...