Get access to all lessons in this course.
-
RMarkdown
- Why Use RMarkdown?
- RMarkdown Overview
- YAML
- Text
- Code Chunks
- Wrapping Up
-
Data Wrangling and Analysis
- Getting Started
- The Tidyverse
- select
- mutate
- filter
- summarize
- group_by
- count
- arrange
- Create a New Data Frame
- Crosstabs
- Wrapping Up
-
Data Visualization
- An Important Workflow Tip
- The Grammar of Graphics
- Scatterplots
- Histograms
- Bar Charts
- color and fill
- scales
- Text and Labels
- Plot Labels
- Themes
- Facets
- Save Plots
- Wrapping Up
-
Wrapping Up
- You Did It!
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 30, 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 30, 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 30, 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 30, 2021
ah! It did it again, when I publish it removes the nhanes and pipe line
David Keyes
March 30, 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.