 In this video, I'll show how to iterate custom functions over data frames in R. I'm using the per-map functions to do this. The goal is to use iteration for several defined and custom functions to wrangle data and mass and to generate multiple visualizations after combining all the reports. The techniques shown in this video are transferable to iteration in R generally. The ability to iterate over lists, data frames, and vectors will greatly increase your computational approach and efficiency. As always, my shareable code is available. See a link in the description. More specifically, this video will focus on accomplishing the aforementioned final goals by incorporating several useful wrangling and iterating techniques. Each technique was introduced more deeply in an earlier brief video. Check the description for links to those earlier videos in the series. For more information, see rfun.library.duke.edu. Now here's what I'll cover. I'll use the RBS package to ingest a census web page and then parse select download links, leading to multiple census reports of the census pulse survey. I'll use the stringer package with regex patterns and the deployer and tidy R packages to wrangle the harvested data into a tidy data frame. This data frame will define the order of the next web pages to harvest. So I'll use the map functions from the per package to iterate over nested tibles to orchestrate the harvesting and parsing of several census web pages. Here, my sub goal is to generate a data frame of URL links to Excel files that I want to download. Now that I have a list of downloadable file links, I'll use the FS package to manage my local file system so that I can download each file for my data project. Then I'll use the read Excel package to manipulate the ingest of several presentation document files, and by that I mean Excel workbooks. These Excel files are optimal as presentation reports, but sub-optimal for computation. Each workbook needs a lot of iterated data wrangling. Then I'll use a combination of a for loop, per map functions, and custom functions to build a combined data frame of consistent tidy data. Alright, now that the data are wrangled for computation, I'm going to generate output from nested data frames. So in this case, I will produce eight separate visual artifacts derived from the North Carolina and South Carolina worksheets. Each worksheet is embedded within five census reports workbooks found in the pulse survey reports. Each workbook originally consists of 51 worksheets. So here, we're tackling the challenge of sub-setting two select worksheets within each workbook. The output then will be visualizations, and by that I mean ggplot2 bar charts that are faceted and ordered over categorical variables. Once generated, they can be further rendered into Quarto generated reports, or stored as files and used as visual objects in a variety of publication tools. Alright, quick note. If you don't need to iterate visualization, that's no problem. This demonstration of iteration is generalizable. The per map workflow supports many use cases of iterating functions over lists. For example, see the background video about nesting data frames for a different example. One of the examples in that video shows iterating to generate multiple regression models. Quick note too, the general technique of nesting data and then looping wrangling functions over those data with the per map functions. This is a very efficient technique in R. In many cases, this is an alternative to writing a for loop. Of course, there's nothing wrong with a for loop, but once you get used to the per map technique, you'll most likely find it easier to compose your iterations. And generally, this is also computationally more efficient. So thanks for watching. As ever, this video is brought to you by the Duke University Libraries, the Center for Data and Visualization, and the RFUN Learning Series.