Skip to content
Coming soon: Ally. Your guide to the world of AI and R. Learn More →
R for the Rest of Us Logo

R in 2 Minutes

Short videos highlighting useful R packages and functions.

Use the view() function to quickly look at your data in R

December 5, 2024

Ever want to take a quick look at your data? In my R in 2 Minutes video, I show how to use the view() function to quickly display data in a separate window. I explain why it's useful at the end of pipelines and how to combine it with functions like filter(). It’s a simple trick that can save time and prevent headaches when working with data in R.

Make all of your plots made in ggplot use consistent fonts

October 31, 2024

Have you ever struggled with keeping fonts consistent across all your data visualizations? It's a common headache, but I've got a solution that'll make your life easier! In my latest blog post, I dive into a couple of little tricks using ggplot2 that'll help you maintain font consistency without having to manually adjust each plot. Here's what I cover: Using the theme_set() function to apply a consistent theme across all your plots Leveraging update_geom_defaults() to set default font...

How to update all of your R packages

October 3, 2024

There are times when working in R that you'll want to update not just one package, but all packages you currently have installed. There are many ways to do this, but I recently saw a tip from Kurt Birson that was so good, I had to make a video to demonstrate it. In the latest R in 2 Minutes video, I show you how to update all of your R packages with just a few lines of code. Here's the code I used in the video:

How to distinguish overlapping points in ggplot

September 19, 2024

Ever made a plot in ggplot where you've got two points that are close together? It can be hard to distinguish them. I've figured out a really nice simple way to make sure all of your points are visible.Code shown in video

How to preview plots at specific dimensions in RStudio

September 12, 2024

If you've ever saved plots made in ggplot to a file, you've probably noticed that the dimensions of your plots you saw in RStudio does not correspond to their dimensions outside of RStudio. I recently learned a tip from Nicola Rennie for how to deal with this. Using the ggrecord() function from the camcorder package, you can preview plots in RStudio so that they have the exact same dimensions as when you save them with ggsave().Code shown in video

How to wrap text automatically in ggplot

August 15, 2024

If you've ever spent time in ggplot trying to get the width of text elements just right, this tip is for you! I recently learned from Nicola Rennie about the element_textbox_simple() function from the ggtext package. This function will automatically wrap your title, subtitle, or other text so that it fits perfectly with your plot.Code shown in video

How to use RStudio's autocomplete feature to easily import data

July 2, 2024

Have you ever started writing code to import data, only to forget what the file you want to import is called? You've got to go find the file, remember its name, and then put into your code. There's a quicker way! In this video, I show how to use RStudio's autocomplete function in order to easily import your data.

Make your code output easier to see in RStudio

June 20, 2024

When I live code, it's often the little things that I do that people are most interested in. I was recently doing some live coding and someone asked how I changed where the output of my code showed up when working in a Quarto document. Here's a short video to show you how to change your code chunk output to show up in your console when working in RStudio.Code shown in video

R doesn't round the way you think it does

May 30, 2024

I can't tell you how much time I've spent thinking about rounding in R. Rounding, you ask? Yep! Rounding in R can be confusing because the way R rounds numbers is different than what you might expect. Here's how it works!Code shown in video