Skip to content
R for the Rest of Us Logo

R for the Rest of Us Blog

What's New in R: February 26, 2024

In the latest issue of What’s New in R, see some more new resources! Want to get this in your inbox? Sign up for What's New in R . Creating Population Pyramid Plots in R with ggplot2 Ever wondered how to make population pyramids in R? In this blog post, Steven P. Sanderson shows you how! It might seem tricky at first to make a population pyramid, but once you see how it works, you’ll be making your own in no time! The Top Programming Languages 2023 Every year, IEEE Spectrum puts out a report...

What's New in R: February 20, 2024

In the latest issue of What’s New in R, see some more new resources! Want to get this in your inbox? Sign up for What's New in R . Stacked line chart with inline labels One of the best parts of making data viz in R is that you can learn from others’ code. The website R Graph Gallery has a ton of great examples of charts made in R. One I came across recently is this stacked line chart of aggregated household wealth in countries around the world. The tutorial for this chart , originally made by...

How to add sparklines to a {gt} table

Any table can be spiced up by adding small visual elements to it. Ideally, this makes the table more engaging and informative. One popular visual element that can get both jobs done is a sparkline . These are little line charts in a table cell that can give you a miniature overview of a time series evolution over time. Sounds complicated? It probably becomes clear when you see it in action. Here, have a look: See those little lines. They show you exactly how the open price of the stock prices...

What's New in R: February 12, 2024

The latest issue of What’s New in R is out with some more new resources! Want to get this in your inbox? Sign up for What's New in R . Workshops for Ukraine For the past couple years, Dariia Mykhailyshyna has been running a set of data-focused workshops to support Ukraine as it struggles with the Russian invasion. They have hosted workshops on a wide range of R topics and you can get access to recordings of past sessions and sign up to attend future workshops. Re-constructing Google Forms...

What's New in R: February 5, 2024

In the latest issue of What’s New in R, see some more new resources! Want to get this in your inbox? Sign up for What's New in R . Efficiency and Consistency: Automate Subset Graphics with {ggplot2} and {purrr} Cédric Scherer is a master of data viz in R . In this article he explains how you can use the {ggplot2} and {purrr} packages to make multiple similar plots at the same time ( it’s a technique I’ve used a lot myself ). R for Data Science, Second Edition The second edition of R for Data...

How to work with times and dates

Time series data is everywhere. But time- and date-related data is notoriously hard to work with. But as always, the tidyverse has a nice package that makes our life just a little bit easier. In this case, it is the lubridate package that helps us. But just like time data itself, it requires a bit of effort to get used to working with lubridate . In this blog post, we go through a couple of things you might struggle with when you want to work with time data. This should help you get started...

What's New in R: January 29, 2024

I’m back, sharing some more new(ish) resources with you. Want to get this in your inbox? Sign up for What's New in R . Stop making messy line charts and create meaningful plots instead The first is a great video from Albert Rapp (who also makes videos on the R for the Rest of Us YouTube channel ) showing how to stop making spaghetti charts like these: And instead make easy to comprehend, meaningful line charts like these: The video shows several tips, including how to use the {gghighlight}...

What's New in R: January 24, 2024

Welcome to first issue of What’s New in R! This is a weekly email with three resources to help you learn new tips and tricks to up your R game. Want to get this in your inbox? Sign up for What's New in R . For the first few issues of What’s New in R, the word “new” may be a bit of a misnomer. That’s because I’ve been thinking about starting What’s New in R for several months and have been collecting resources throughout that time. The resources may be a few months old, but who’s counting?...

How to create a gauge plot/speedometers in ggplot

Gauge plots are a nice way to visualize progress or parts-of-a-whole in general. Due to their round shape, they are sometimes also called speedometer plots. Here’s an example chart. It shows you how much of your goal you have already achieved. Basically, this is a round version of a parts-of-a-whole bar chart. If you want to create one of those, you can check out another one of our blog posts . In this one, we’ll show you how to create the rounded brother. Let’s dive in. The data First, we...

Getting Started with {geomtextpath}

Have you ever created a great line graph only to feel frustrated that it requires a messy, hard to read legend? What if you could label the lines directly? Even the curvy ones? And have the text follow the curvature of the lines! With the {geomtextpath} package, you can annotate your ggplot2 visualizations with clean labels and customized text annotations that can follow the shapes in your data, and it’s so much easier to get started than you’d imagine. The Basics First, let’s load our...