Skip to content
R for the Rest of Us Logo

R for the Rest of Us Blog

Spice up your {gt} table with {ggplot}

Have you ever created a table with gt and thought to yourself “Well, maybe just showing the numbers doesn’t cut it? I need to add some visual spice to this table.” If so, then you’re in great company. Because spicing up tables with visuals is one of my favorite tricks. I like to add visual elements like small lines or bars to tables. Apart from making your table pretty, visuals help to convey an overall impression of the data to your reader. So, let me show you how you can add any chart to...

How to Order Bars and Lines in ggplot

With visualizations, it’s always better if there is some visual order in your charts. For example, take a look at these two bar charts. Which one do you find easier to read? And which chart gives you a better overview over the data? If you are like most people, then chances are that you will find that the sorted bar chart is easier to read. This simple action of sorting the bars can give a lot of structure to your data visualization. In turn, your chart is easier to understand for your...

How to add annotations in ggplot: should you use geoms or annotations?

Annotations are a neat way to draw your readers attention to specific parts of your data visualization. For example, you could use, say, an arrow to point to a specific data point, a rectangle to draw a border around specific points in a scatter plot that you want to highlight or a text label to clarify something. The possibilities for annotations are endless. Here’s a plot that combines these ideas into a ggplot. You can create such annotations with the annotate() layer. Who would have...

How to Create Your Own Table Theme with the gt Package

In our consulting work at R for the Rest of Us, we create tables all the time. We don’t just make plain tables, we make tables that look good and communicate well. This is important because: A clean design is more convincing A powerful design stands out so that people actually look at our tables We can use colors to reflect our clients’ branding We recently helped the Oregon Voices project to create customized data reports for every county in Oregon. Among other things, this required creating...

R for the Rest of Us Podcast Episode 12: Chris Knox

In this episode, I speak with Chris Knox, who is currently the Head of Data Journalism at the New Zealand Herald. Prior to that, he worked at the New Zealand ministry of health, where he led an analytics team focused on New Zealand's COVID response. During our conversation, Chris highlights why he considers R as the optimal tool for data analysis and reporting, especially when dealing with frequently changing data sources and parameters. He also emphasizes the benefits of using R in a...

How to Use GitHub Actions with R to Run Code Automatically

In my course, Using Git and GitHub with R , I talk about GitHub Actions as one of the best reasons to use GitHub. GitHub Actions is a way for you to run code automatically, without you having to touch your computer. Maybe you run a survey and you want to pull the data every day. Or perhaps you want to generate a weekly report. Instead of manually running code in RStudio, you can use GitHub Actions to run this code automatically. Below, I will demonstrate two GitHub Actions: one that imports...

R for the Rest of Us Podcast Episode 11: Garrick Aden-Buie and Travis Gerke

In this episode, Travis Gerke and Garrick Aden-Buie join me to demystify the process behind developing custom packages in R. Travis is the Director of Data Science at The Prostate Cancer Clinical Trials Consortium (PCCTC), and Garrick is a Data Science Educator and R developer at R Studio. During the discussion, Travis and Garrick highlight the numerous benefits of having a custom package, including making it easier to access data, automation & documentation of functions, and enhanced...

R for the Rest of Us Podcast Episode 10: Kyle Walker

In this episode, I speak with Kyle Walker, Associate Professor of Geography and Director of the Center for Urban Studies at Texas Christian University. Kyle has developed several packages, but the one we talk about in this chat is called tidycensus. tidycensus allows R users to return Census and ACS data as tidyverse-ready data frames. Kyle had a rough start with R programming and he didn’t want anything to do with it for 3 years. What made him come back to R and become one of its renowned...

R for the Rest of Us Podcast Episode 9: Meghan Harris

In this episode, I speak with Meghan Harris, a data integration specialist at the Primary Care Research Institute, University of Buffalo. There, she brings together data from multiple sources to create insights that benefit people affected by opioid use disorder. Meghan talks about how she uses R to pull data directly from Google Sheets, and highlights the advantages of this workflow as opposed to working on a manually downloaded Google Sheets file. Fun fact: When Meghan is not creating data...

R for the Rest of Us Podcast Episode 8: Matt Herman

In this episode, I chat with Matt Herman about building websites in R. Matt shares lessons from his experience building a self-updating Covid-19 tracking site for Westchester County. Matt is a Data Scientist at the Council of State Governments (CSG) Justice Center, where he focuses on research and policy analysis. Matt has created automated and reproducible workflows to generate outcome measures and performance indicators for several projects within the justice system. Listen to the Audio...