Skip to content
R for the Rest of Us Logo

Working with Columns with across()

This lesson is locked

Get access to all lessons in this course.

If the video is not playing correctly, you can watch it in a new window

Transcript

Click on the transcript to go to that point in the video. Please note that transcripts are auto generated and may contain minor inaccuracies.

Your Turn

  • Load the midwest data bundled with ggplot2

  • Keep only rows for Ohio (OH)

  • Subset the ‘county’ column and all columns that match the string ‘pop‘ (hint: use a selection helper)

  • Square-root transform all numeric variables

Learn More

The tidyverse blog announcing dplyr 1.0 had a nice overview of the across() function.

Have any questions? Put them below and we will help you out!

You need to be signed-in to comment on this post. Login.

FELIPE SANCHEZ NAJERA

FELIPE SANCHEZ NAJERA

October 11, 2023

Hi! I just wanted to ask why the professor mutates the numeric variables into a log scale; what is the purpose or usefulness of this transformation instead of using the non-mutated data?

David Keyes

David Keyes Founder

October 11, 2023

I don't think the transformation really matters here. It's just a toy example in order to demonstrate how to work across multiple variables.