Get access to all lessons in this course.
-
Week 1: Getting Started with R
- Welcome to Getting Started with R
- Install R
- Install RStudio
- Projects
- Files in R
- Packages
- Import Data
- Objects and Functions
- Examine our Data
- Import Our Data Again
- Getting Help
- Wrapping Up
- R in 3 Months Spring 2022 Week 1 Live Session
-
Week 2: Fundamentals of R (RMarkdown)
- Welcome to Fundamentals of R
- RMarkdown Overview
- YAML
- Text
- Code Chunks
- Wrapping Up
- R in 3 Months Spring 2022 Week 2 Project Assignment
- R in 3 Months Spring 2022 Week 2 Office Hours
- R in 3 Months Spring 2022 Week 2 Live Session
-
Week 3: Fundamentals of R (Data Wrangling and Analysis)
- Getting Started
- The Tidyverse
- select
- mutate
- filter
- summarize
- group_by
- count
- arrange
- Create a New Data Frame
- Crosstabs
- Wrapping Up
- R in 3 Months Spring 2022 Week 3 Office Hours
- R in 3 Months Spring 2022 Week 3 Live Session
- R in 3 Months Spring 2022 Week 3 Project Assignment
-
Week 4: Fundamentals of R (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
- You Did It!
- R in 3 Months Spring 2022 Week 4 Office Hours
- R in 3 Months Spring 2022 Week 4 Live Session
- R in 3 Months Spring 2022 Week 4 Project Assignment
-
Week 5: Catch-Up Week
- R in 3 Months Spring 2022 Week 5 Office Hours
- R in 3 Months Spring 2022 Week 5 Project Assignment: ASSIGNMENT AMNESTY
-
Week 6: Git + GitHub
- What is Git? What is GitHub?
- Why Should You Learn to Use Git and GitHub?
- Update Everything
- Install Git
- Configure Git
- Create a Local Git Repository
- Commits
- Commit History
- GitHub Repositories
- Connect RStudio and GitHub
- Push an RStudio Project to a GitHub Repository
- Pull a GitHub Repository to an RStudio Project
- Keep RStudio and GitHub in Sync
- R in 3 Months Spring 2022 Week 6 Office Hours
- R in 3 Months Spring 2022 Week 6 Live Session
- R in 3 Months Spring 2022 Week 6 Project Assignment
-
Week 7: Going Deeper with R (Advanced Data Wrangling, Part 1)
- Overview
- Importing Data
- Tidy Data
- Reshaping Data
- Dealing with Missing Data
- Changing Variable Types
- Advanced Variable Creation
- Advanced Summarizing
- Binding Data Frames
- R in 3 Months Spring 2022 Week 7 Office Hours
- R in 3 Months Spring 2022 Week 7 Project Assignment
- R in 3 Months Spring 2022 Week 7 Live Session
-
Week 8: Going Deeper with R (Advanced Data Wrangling, Part 2)
- Functions
- Merging Data
- Renaming Variables
- Quick Interlude to Reorganize our Code
- Exporting Data
- R in 3 Months Spring 2022 Week 8 Office Hours
- R in 3 Months Spring 2022 Week 8 Live Session
- R in 3 Months Spring 2022 Week 8 Project Assignment
-
Week 9: Catch-Up Week
- R in 3 Months Spring 2022 Week 9 Office Hours
- R in 3 Months Spring 2022 Week 9 - Assignment Amnesty
-
Week 10: Going Deeper with R (Advanced Data Visualization, Part 1)
- Data Visualization Best Practices
- Tidy Data
- Pipe Data Into ggplot
- Reorder Plots to Highlight Findings
- Line Charts
- Use Color to Highlight Findings
- Declutter
- Use the scales Package for Nicely Formatted Values
- Use Direct Labeling
- R in 3 Months Spring 2022 Week 10 Office Hours
- R in 3 Months Spring 2022 Week 10 Live Session
- R in 3 Months Spring 2022 Week 10 Project Assignment
-
Week 11: Going Deeper with R (Advanced Data Visualization, Part 2)
- Use Axis Text Wisely
- Use Titles to Highlight Findings
- Use Color in Titles to Highlight Findings
- Use Annotations to Explain
- Tweak Spacing
- Customize Your Theme
- Customize Your Fonts
- Try New Plot Types
- R in 3 Months Spring 2022 Week 11 Live Session
- R in 3 Months Spring 2022 Week 11 Office Hours
- R in 3 Months Spring 2022 Week 11 Project Assignment
-
Week 12: Going Deeper with R (Advanced RMarkdown)
- Advanced Markdown Text Formatting
- Tables
- Advanced YAML
- Inline R Code
- Making Your Reports Shine: Word Edition
- Making Your Reports Shine: HTML Edition
- Making Your Reports Shine: PDF Edition
- Presentations
- Dashboards
- Other Formats
- You Did It!
- R in 3 Months Spring 2022 Week 12 Office Hours
- R in 3 Months Spring 2022 Week 12 Live Session
- R in 3 Months Spring 2022 Week 12 Project Assignment
-
Week 13: Final Assignment
- R in 3 Months Spring 2022 Week 13 Office Hours
- R in 3 Months Spring 2022 Week 13 Live Session
- R in 3 Months Spring 2022 Final Project Assignment
-
WEEK 14: Retrospective
R in 3 Months (Spring 2022)
Try New Plot Types
This lesson is locked
This lesson is called Try New Plot Types, part of the R in 3 Months (Spring 2022) course. This lesson is called Try New Plot Types, part of the R in 3 Months (Spring 2022) 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
Use one of the packages above to make a unique plot. For example, you might use dumbell plots in the
ggalt
package to show change in the Hispanic/Latino population from 2017-2018 to 2018-2019 for all districts.When you finish your plot, email it to me at [email protected]! I’d love to see what you come up with.
Heads up: You likely want to watch the solutions video because it involves reshaping the data to make it work with the ggalt
package.
Learn More
You can see all of the geoms built into ggplot here.
The documentation websites for the packages discussed in this lesson are below:
gganimate (you can see the sample plot shown in the video here )
patchwork (here's the tweet about it that went "nerd viral ")
cowplot (here's the Spotify visualization by Cedric Scherer made with it)
shadowtext (my tweet about the Financial Times plot is here ; the code used to make that plot is here , though note that it no longer appears to work)
To learn more about other things that. arepossible with ggplot, check out the awesome ggplot2 GitHub repository , which has a list of a lot of other great ggplot extensions to try out!
I'd also recommend looking at the Data to Viz website , which lists various visualization options and provides sample R code for each.
Finally, if you're not already following Tidy Tuesday , check it out! Every week, a new data set is released, which people then analyze and visualize. They post their results using the #TidyTuesday hashtag. The most incredible thing is that people often post their code alongside their visualizations so you can see how they did what they did.
Three regular Tidy Tuesday contributors I'd recommend following (their work is exceptional and they always post their code) are:
You need to be signed-in to comment on this post. Login.
Atlang Mompe
June 24, 2021
Hi David, I have loaded the janitor package like you did and ran the code on the solution just to see if it works but I get this error: Error in geom_dumbbell(colour_x = "gray", colour = "gray", colour_xend = "blue", : could not find function "geom_dumbbell" >
David Keyes Founder
January 9, 2022
I do! The code to make it is here. I found this plot on Twitter originally.
David Keyes Founder
January 11, 2022
Yup, it's the best!
Jeremy Danz
February 12, 2023
So, I tried re-creating the solution here, and despite changing various things, both the x and xend seem to be getting plotted at -1.0 ?
This is the code I've gotten to now - I was mostly changing bits to see what was broken and what the result of the changes was..
enrollment_by_race_ethnicity %>% filter(race_ethnicity == "White") %>% select(-c(race_ethnicity, number_of_students, district_id)) %>% pivot_wider(id_cols = district, names_from = year, values_from = percent_of_total_at_school)%>% slice(1:10)%>% ggplot(aes(x = 2017-2018, xend = 2018-2019, y = district, yend = district)) + geom_dumbbell(colour_x = "gray", colour = "gray", colour_xend = "red", size_x = 10, size_xend = 1.5) + theme_jd() + scale_x_continuous()
This is a link to the image it's producing .... https://imgur.com/a/PVKb9Td
thanks for any suggestions!
Andrew Paquin
May 27, 2023
When I try to pipe the data (after wrangling) directly into ggplot, etc., I don't get a graph in my Markdown doc. Instead, in my environment pane, I get a file denoted with a magnifying class instead of a table icon. When I open it, I see a lise of attributes (Name, type, value). If I don't pipe the data, it works as expected. Any ideas?