How to Make 250+ Plots at the Same Time with R

For the past several years, I've worked on a report called Oregon by the Numbers. In this project, I use R to make every single plot in the report: over 250 plots each year.

In the time I've worked on this project, I've become more and more efficient at making these plots. My efficiency comes thanks to the walk()
function from the purrr
package. This function can be confusing, but if you learn how to use it, you too can make hundreds of plots in just a few lines of code.
As you'll see in the video below, the process is as follows:
Make a function to make one plot
Create a vector with all options for different plots (in my case, that is all of the 36 counties in Oregon)
Use the
walk()
function to make one plot for each county
Take a look!
Interested in the code I used in this demo? It's available on GitHub.
You need to be signed-in to comment on this post. Login.
Fayyaz Ahmad
January 11, 2023
very informative