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

Fundamentals of R

Bring it All Together (Data Wrangling)

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.

View code shown in video
# Load Packages -----------------------------------------------------------

library(tidyverse)
library(janitor)

# Import Data -------------------------------------------------------------

# Data from https://github.com/rstudio/r-community-survey

survey_data <- read_tsv("2020-combined-survey-final.tsv") |>
  clean_names()

survey_data |>
  select(contains("enjoy"))

avg_r_enjoyment <-
  survey_data |>
  drop_na(qr_enjoyment) |>
  group_by(qcountry) |>
  summarize(
    avg_enjoyment = mean(qr_enjoyment),
    number_of_responses = n()
  ) |>
  filter(number_of_responses >= 10) |>
  arrange(desc(avg_enjoyment))

Learn More

The data used in this lesson comes from the R Community Survey conducted in 2020.

To learn more about the Air code formatter, check out its docs.

If you want to see a visual representation of how the various dplyr functions you've learned in this section of the course work, check out the Tidy Data Tutor website.

A less visual, though equally useful, approach is the tidylog package. It gives you feedback on each step of your pipeline, showing the data was transformed.

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

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

Al-Afroza Sultana

Al-Afroza Sultana • April 10, 2026

Hi, I am facing difficulty in installing janitor. After installing the library(tidyverse) in a new window, when I run the code library(janitor), it says- there is no package called ‘janitor’. Please let me know how to fix it. Thanks

Gracielle Higino

Gracielle Higino Coach • April 13, 2026

The janitor package is not part of the tidyverse, it should be installed separately. Run the following and let us know if it solves the problem:

install.packages("janitor")
library(janitor)
Al-Afroza Sultana

Al-Afroza Sultana • April 15, 2026

Yes, it worked. I didn't realize it's a different package. Thank you, Gracielle!