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)
Save Plots
This lesson is locked
This lesson is called Save Plots, part of the R in 3 Months (Spring 2022) course. This lesson is called Save Plots, 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
Complete the save plots sections of the data-visualization-exercises.Rmd file.
Learn More
Saving Plots Resources
I have only showed you how to save plots by saving the last plot you made. You can also save a plot as an object and then use this object as an argument in your ggsave function. For more on doing that, see the relevant page from the Stat545 course by Jenny Bryan.
You need to be signed-in to comment on this post. Login.
Catherine Roller White
April 14, 2021
I was able to save this as a .png, but when I tried to save as a .pdf, I received this message:
Error in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : invalid font type
It still created a .pdf, but the only text on the figure was the data labels (no title, axes, etc.) Perhaps we will be covering this on Thursday when we talk about fonts? Thank you.
Abby Isaacson
April 15, 2021
I saved without any errors, but I can't find it anywhere! Not in my files, nor the "plots" tab (what is that?).
Elan Sykes
October 13, 2021
My code for the facets section worked to get the right plot, and I wrote my saving code the same way the solutions suggest, but when I save the plot the background turns from white in the facets section original plot to dark grey in the png file. Is this something from the default? And how do I change individual elements of the plot while keeping the overall theme?
Andrew Paquin
April 5, 2023
Hi David, I have encountered a problem during this lesson. Something is up with RStudio, and I can't put my finger on it. It had been working well, but suddenly it appears that tidyverse is unavailable to me. When I try to knit, I get the following:
Error: package or namespace load failed for ‘tidyverse’: .onAttach failed in attachNamespace() for 'tidyverse', details: call: NULL error: package or namespace load failed for ‘ggplot2’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]): namespace ‘rlang’ 1.0.6 is already loaded, but >= 1.1.0 is required
I've also been getting this a lot: In addition: Warning message: In gzfile(file, mode) : cannot open compressed file 'C:\Users\paquinan\AppData\Local\Temp\Rtmp4cUZ6h/libloc_185_13d200b7.rds', probable reason 'No such file or directory'
All of this started last night when I tried to access my html file for this section and realized that there isn't one.
Any ideas?
I have tried to run updates, and I see that there are six of them, but they don't take. I go through a perpetual cycle of being asked if I want R to restart. In the end, nothing changes. This ongoing cycle (being asked about restarting R, saying yes, being asked again...) is accompanied by repetitions of this message:
> install.packages(c("cli", "ggplot2", "htmltools", "ps", "rlang", "vctrs")) Error in install.packages : Updating loaded packages
Restarting R session...
Melissa Mullins
April 19, 2023
My plot looked great as a png even though I had overlapping text issues displaying in R studio. I wanted to see what they looked like if I knit, but I couldn't successfully do it. When it gets to this line of code install.packages("devtools") I get an error that says this: processing file: data-visualization-exercises.Rmd |....................................... | 77% (unnamed-chunk-19)Quitting from lines 276-279 (data-visualization-exercises.Rmd) Error in contrib.url(repos, "source") : trying to use CRAN without setting a mirror Calls: ... eval_with_user_handlers -> eval -> eval -> install.packages -> contrib.url
Execution halted
Suggestions appreciated!