An Example of How R Can Improve Your Workflow
I often tell people that R can improve their workflow. But, as everyone knows, showing is better than telling. So, in that spirit, I made a video to demonstrate one way in which R can improve your efficiency.
I often work with data from the U.S. Census Bureau. My old workflow was as follows:
Go to the Census Bureau website
Downloading the data I need
Use the data to make charts in Excel
Copy these charts into Word
Write my report in Word
Since I switched to R, I've been able to do all 5 steps in R. Using the tidycensus package along with RMarkdown, I can find the data I need from the Census Bureau, import it, make charts, and write my report in a single RMarkdown document. When I'm ready to share my results, I simply export (aka knit) to a format that I can share, like Word.
This new R-based workflow is a huge timesaver even if you only make one chart (as I do in the video). But, if you make, say, 50 charts, imagine how much time you can save. Simply copy the code you used to import the data and make your first graph, change it in a couple places to get different data, and you can have new charts ready.
As I've written, R is, at its core, a workflow tool. Now I have an example to show people just how it can be in improving their workflow.
Sign up for the newsletter
Get blog posts like this delivered straight to your inbox.
You need to be signed-in to comment on this post. Login.
Alberto Cabrera • May 8, 2024
I had problems running the script using Quarto, format: docs. The census data were not displayed in the Viewer window. It displayed the message it ran out of space. However, the script, pending some small YAML changes, worked using html format.
Many thanks again for an excellent lecture in the use of US Census data. I wonder if in the future you may include a lesson or a course regarding the use of the US Department of Education's datbases.
David Keyes Founder • May 9, 2024
Hmm, yes, I haven't tried this exact code out with Quarto so there may be some issues.
On the US Department of Education data, can you tell me which specific datasets you tend to use?
Alberto Cabrera • May 9, 2024
National Center for Education Statistics. Most of their data are displayed in excel files. I wish NCES would adopt a tidyverse approach as US Census did.
David Keyes Founder • May 9, 2024
I haven't used it, but there is a package to work with NCES data. Might be worth checking out!
Alberto Cabrera • May 9, 2024
Wow! This is gold. Many thanks for the lead. I have been downloading excel files all this time without knowing about this impressive tool.
Risking to pose to you a dumb question. In one of your lectures you showed an option in Quarto to display the results in the Viewer instead of below the code chunk. I just can't find it .