- Welcome to Fundamentals of R
- Update Everything
- Start a New Project
-
Data Wrangling and Analysis
- The Tidyverse
- Pipes
- select()
- mutate()
- filter()
- summarize()
- group_by() and summarize()
- arrange()
- Create a New Data Frame
- Bring it All Together (Data Wrangling)
-
Data Visualization
- The Grammar of Graphics
- Scatterplots
- Histograms
- Bar Charts
- Setting color and fill Aesthetic Properties
- Setting color and fill Scales
- Setting x and y Scales
- Adding Text to Plots
- Plot Labels
- Themes
- Facets
- Save Plots
- Bring it All Together (Data Visualization)
-
Quarto
- Quarto Overview
- YAML
- Text
- Code Chunks
- Tips for Working with Quarto
- Bring It All Together (Quarto)
-
Wrapping Up
- An Important Workflow Tip
Fundamentals of R
Bring it All Together (Data Wrangling)
This lesson is called Bring it All Together (Data Wrangling), part of the Fundamentals of R course. This lesson is called Bring it All Together (Data Wrangling), part of the Fundamentals of R 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.
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"))
survey_data |>
filter(is.na(qr_enjoyment)) |>
select(qr_enjoyment)
survey_data |>
glimpse()
avg_r_enjoyment <- survey_data |>
drop_na(qr_enjoyment) |>
group_by(qcountry) |>
summarize(avg_enjoyment = mean(qr_enjoyment),
n = n()) |>
filter(n >= 10) |>
arrange(desc(avg_enjoyment))
Learn More
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.
You need to be signed-in to comment on this post. Login.