Skip to content
R for the Rest of Us Logo

Blog

Learn to use the most powerful tool for working with data.
Even if you've never coded before.

How to make heatmaps in ggplot

May 1, 2025

Heatmaps are a common way of representing data. In this blog post, I'll show you how to make your own heatmaps using ggplot. In the process, you'll learn a bit about working with the {sf} package, specifically the st_make_grid() function to make a grid, the st_intersection() function to clip the boundaries of your geography to the grid you create, and st_join() to do spatial joins. This blog post is adapted from a lesson in the Mapping with R course . If you want to learn to make heatmaps...

Use shadows in ggplot to highlight findings

April 24, 2025

In our consulting work, we make a lot of the data visualization for parameterized reporting . It’s something I spoke about in my 2024 Cascadia R Conf talk, How to Make a Thousand Plots Look Good: Data Viz Tips for Parameterized Reporting . One example I gave in this talk came from our work with the Johns Hopkins International Vaccine Access Center and the World Health Organization . In this project, we made reports for the Immunization Agenda 2030 project, which tracks the progress countries...

Create your own custom {ggplot2} theme

April 3, 2025

Creating custom themes in {ggplot2} lets you elevate your data visualizations from standard to standout. Whether you’re aiming for a polished, brand-consistent look for your organization or a unique aesthetic that reflects your personal style, a custom theme function makes it easy to apply your design to all figures with a single line of code. In this tutorial, we’ll cover: the essentials of the powerful ggplot2::theme() function, including how to adjust fonts, colors, sizing, and spacing;...

Hide text labels with small values to make charts made in ggplot easier to read

March 13, 2025

One issue that we often face when making data visualization in reports is text not fitting into graphs. This happened to us when working on reports for the Connecticut Data Collaborative and the Partnership for Strong Communities in Connecticut. The reports we made , which show key demographic and housing indicators for towns and counties across the state, have bar charts that show the housing cost burden for renters and home owners in the state. In addition to the categories severe burden...

What's New in R

A weekly roundup of new resources in the world of R.

What’s New in R: April 28, 2025

April 28, 2025

Welcome to this week’s edition of What’s New in R ! This week, we’re featuring a new R package for accessing elevation data, an overview of what’s new in R 4.5, and a guide to replicating Financial Times-style data visualizations. Let’s dive in! Introducing {elevationus}: An R Package to Retrieve Elevation Data for U.S. Geographies Joey Marshall has released a new R package designed to make retrieving elevation data a breeze. Whether you’re working with geographic data or need elevation...

What’s New in R: April 21, 2025

April 21, 2025

Welcome to this week’s edition of ​What’s New in R ​! This week, we’re featuring a TidyTuesday analysis on racial disparities in reproductive research, a tutorial on using ggplot2 to visualize relationship between life expectancy and health spending, and insights on R packages. Let’s dive in! TidyTuesday: Racial disparities in reproductive research In this insightful post, Jess Graves explores a TidyTuesday dataset, providing a detailed analysis and visualization. This resource is perfect for...

What’s New in R: April 14, 2025

April 14, 2025

Welcome to this week’s edition of ​What’s New in R ​! This week, we’re featuring a data hub for dengue research, a guide to advanced data skills, and a resource for spatial data in R. Let’s dive in! Dengue Data Hub The Dengue Data Hub is a comprehensive resource for researchers focusing on dengue fever. The website, made by Thiyanga S. Talagala, has information on the {denguedatahub} package, which has data from many locations around the world, and provides an interactive data explorer for...

What’s New in R: April 7, 2025

April 7, 2025

Welcome to this week’s edition of ​What’s New in R ​! This week, we’re featuring a YouTube tutorial on the {purrr} package, a list of ten great R functions, and a guide on fixing awkward backgrounds in ggplot. Let’s dive in! Hello Kitty: Intro to {purrr} | TidyX Episode 184 In Episode 184 of TidyX, hosts Ellis Hughes and Patrick Ward delve into the {purrr} package, focusing on the use of map functions to manipulate lists. They explain the importance of using map functions when dealing with...

R in 2 Minutes

Short videos highlighting useful R packages and functions.

Learn to make an R package in less than 2 minutes

April 17, 2025

Have you ever wanted to create your own R package but thought it was too complicated? I used to think the same thing! But I recently learned how to create a simple theme package in R, and I want to show you just how easy it can be. So easy that I can demonstrate the process in just two minutes! In this quick video, I walk you through the step-by-step process of creating your own R package. Here's what I cover: Creating a new package project in RStudio Setting up the package structure using...

Use the {beepr} package to be notified when your R code is done

March 27, 2025

Tired of waiting for your R script to finish running? In my latest "R in 2 Minutes" video, I showcase the {beepr} package, which plays a sound when your code is complete, so you don’t have to keep checking! I demonstrate how it works using a time-consuming task—importing multiple CSV files—and explore various fun sound options, including nostalgic ones. Plus, my son Elias joins as a special guest, adding some comic relief while we wait. This simple trick can save time and make your R coding...

How to use the add_row() function in R

March 6, 2025

Ever needed to quickly add just one row of data to your dataset in R? Maybe you forgot an entry or want to add something new? I recently ran into this exact situation while making a chart with my son showing the highest soccer goal scorers of all time. He wanted to add himself to the list (dreaming big, right?). In this quick video, I show you how to use the add_row() function from the tidyverse to easily add a single row of data to your existing dataset. It's super straightforward - you just...

How to read in hundreds of CSV files with one line of code

February 13, 2025

Ever found yourself staring at a folder full of CSV files, wondering how on earth you're going to import them all without writing a ton of code? I've been there! I used to think I needed some complex solution, but it turns out you can do it with just one line of code. In this quick video, I show you how to: Use the {fs} package along with the tidyverse Create a vector of all your CSV files in a directory Import them all at once using read_csv() (not read.csv()!) The best part? This method...

Podcast

Conversations with users around the world about interesting things they are doing with R.

R for the Rest of Us Podcast Episode 25: Robert Smith

March 20, 2025

In this episode, I chat with Robert Smith, a health economist and co-founder of Dark Peak Analytics. Rob shares his unique career path from academia to advising the UK government during the COVID-19 pandemic, where he helped shape public health decisions through data modeling. We also discuss his work with Parkrun, a free community running event, and how data science can be used to promote equitable access to fitness. Using R, Rob and his team analyzed participation trends and developed...

R for the Rest of Us Podcast Episode 24: Simon Couch

February 27, 2025

In this episode, I chat with Simon Couch, a software engineer at Posit, where he develops open-source statistical software and maintains several R packages. Simon’s work spans AI-powered coding tools that enhance R workflows and improve efficiency. We dive deep into his latest projects: {pal} (renamed to {chores}) – an AI-powered assistant that streamlines code updates and automates tedious R programming tasks. {gander} – an innovative tool that integrates AI into RStudio and Positron,...

R for the Rest of Us Podcast Episode 23: Terence Teo

February 6, 2025

In this episode, I chat with Terence Teo, Professor at Seton Hall University and expert in creating stunning 3D maps using the {rayshader} package in R. Terence discusses his journey into data visualization, specifically his use of R and the RayShader package to create mesmerizing 3D maps. Terence shares insights from his academic background in political science, his creative process for making maps, and how he balances artistic flair with technical rigor. The discussion dives into geospatial...

R for the Rest of Us Podcast Episode 22: Alex Gold

December 12, 2024

In this episode, I chat with Alex Gold, who leads solution engineering and support teams at Posit. We talk about his new book ‘ DevOps for Data Science’ , and explore why DevOps principles are crucial for data scientists, even if you aren't working in hardcore production environments. Alex shares insights on how to think about putting your data science projects into "production"—whether it's a report for colleagues or a full-scale deployment. We discuss practical tips like using {renv} to...