R Week: Using R to Create and Update Reports by Dana Wanzer

Hi! I’m Dana Wanzer, assistant professor of psychology in evaluation at the University of Wisconsin-Stout and avid #EvalTwitter user! 

My last “a-ha!” moment using R, and the one that has solidified that I am never going back to my previous statistical software, was when I realized how quickly and easily I could create reports

Have you ever had more data come in after you finished the report? I have, and it was always a nightmare. I had to update every single analysis, graph, and table. It was exhausting, it was time-consuming, and it was expensive. But when I realized I could use R in a way that saved me (and, more importantly, my clients!) time and money, I was completely on board!

Just like you might in another statistical software, it requires having all of your statistical syntax ready to go in R code. The difference here is that I can add my text, tables, figures, and even formatting into the same R code document, called an R Markdown (Rmd) file. When I’m done with writing the report and doing all of the analyses, I “knit” the document, and voila! A report is born! 

Cool Trick: When new data comes in, or when you find an error with your data, all you have to do is fix your data and click “knit” again! No more manually updating everything, R does it all for you. This is a prime example of a reproducible workflow in which I can easily and quickly reproduce what I did even when new data comes in. 

Rad Resource: Want to see this in action? Check out the HTML report here and the Rmd file here. These are all uploaded on Github, along with the data, so you can download and edit for use in your own reports! 

Hot Tip: Do you have to do break-out reports a lot, such as an individualized report for each site you surveyed? With a few simple lines of code, you can have R create all of your reports for you automatically!

Lessons Learned: This may not be the solution for everyone. There is a lot of upfront work required for these reports: you need to know how to use R and still might need to do extra formatting at the end. Also, if you’re creating multiple files from the same Rmd, it is difficult to add interpretations to the reports when those interpretations may differ across reports; this may require extra time in adding your interpretations of the data to each report. However, these limitations are more preferable to me than spending (and charging!) hours of work doing this manually. 

The American Evaluation Association is celebrating R Week with our R-forward colleagues who have contributed all of this week’s aea365 posts. Do you have questions, concerns, kudos, or content to extend this aea365 contribution? Please add them in the comments section for this post on the aea365 webpage so that we may enrich our community of practice. Would you like to submit an aea365 Tip? Please send a note of interest to aea365@eval.org. aea365 is sponsored by the American Evaluation Association and provides a Tip-a-Day by and for evaluators.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.