Get access to all lessons in this course.
- 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
Create a New Data Frame
This lesson is locked
This lesson is called Create a New Data Frame, part of the Fundamentals of R course. This lesson is called Create a New Data Frame, part of the Fundamentals of R course.
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
Complete the create a new data frame sections of the data-wrangling-and-analysis-exercises.Rmd file.
Learn More
General Data Wrangling and Analysis Resources
Because most material that discusses data wrangling and analysis with the dplyr packges does so in a way that covers all of the verbs discussed in this course, I have chosen not to separate them by lesson. Instead, here are some helpful resources for learning more about all of the tidyverse verbs discussed in this course:
Chapter 5 of R for Data Science
RStudio Cloud primer on working with data
Tidyverse for Beginners by Danielle Navarro
Learning Statistics with R by Danielle Navarro
Introduction to the Tidyverse by Alison Hill
A gRadual intRoduction to data wRangling by Chester Ismay and Ted Laderas
You need to be signed-in to comment on this post. Login.
Abby Isaacson
March 31, 2021
when I try this simple renaming, I get the error (below code): mental_health_over_30 % filter(age >= 30) %>% group_by(gender) %>% summarize(mean_bad_mental_health_days = mean(days_ment_hlth_bad, na.rm = TRUE)) %>% mutate(mean_bad_mental_health_days = round(mean_bad_mental_health_days, digits = 1)) %>% arrange(desc(mean_bad_mental_health_days))
summarise()
ungrouping output (override with.groups
argument)Abby Isaacson
March 31, 2021
correction in code, still error: mental_health_over_30 % filter(age >= 30) %>% group_by(gender) %>% summarize(mean_bad_mental_health_days = mean(days_ment_hlth_bad, na.rm = TRUE)) %>% mutate(mean_bad_mental_health_days = round(mean_bad_mental_health_days, digits = 1)) %>% arrange(desc(mean_bad_mental_health_days))
Abby Isaacson
March 31, 2021
well apparently, cutting and pasting the top line doesn't show up as normal. mental_health_over_30 % is the first line
Abby Isaacson
March 31, 2021
ah! It did it again, when I publish it removes the nhanes and pipe line
David Keyes
March 31, 2021
No worries on the copying and pasting not working. This is not an error, just an informational message. If you want to learn more, I made a video about it. We'll also talk about it on Thursday.