All the packages used (in any way - homework, lecture, lab), are listed in this text file. If you would like to install all the packages from this file, please download that text file and run this R script
All the functions used (in any way - homework, lecture, lab), are listed in this CSV file, which can start a kind of cheat sheet for you.
All the data used that are not specifically to be downloaded from the web are located in this zip file, but we will show you how to read data from the internet as well.
Module | Slides | Code | Resource | In Class Work |
---|---|---|---|---|
Day 0 | ||||
Homework 1 | Try R, Data Camp | |||
Day 1 | ||||
Intro | HTML, PDF | R, Rmd | ||
RStudio | HTML, PDF | R, Rmd | ||
Basic R | HTML, PDF | R, Rmd | Lab, Key | |
Data IO | HTML, PDF | R, Rmd | Lab, Key | |
Homework 2 | R, Key | |||
Day 2 | ||||
Subsetting Data in R | HTML, PDF | R, Rmd | Lab, Key | |
Data Summarization | HTML, PDF | R, Rmd | Lab, Key | |
Day 3 | ||||
Data Classes | HTML, PDF | R, Rmd | Lab, Key | |
Data Cleaning | HTML, PDF | R, Rmd | Lab, Key | Live R file |
Homework 3 | R, Key | |||
Day 4 | ||||
Manipulating Data in R | HTML, PDF | R, Rmd | Lab, Key | Live R file |
Data Visualization | HTML, PDF | R, Rmd | Lab, Key | Live R file |
Day 5 | ||||
Statistics | HTML, PDF | R, Rmd | Lab, Key | Live R file |
Functions | HTML, PDF | R, Rmd | ||
Knitr | HTML, PDF | R, Rmd |
ggplot2
figureExample projects can be found with the source code: Rmd, and the output Docx here.
Code Example | Script |
---|---|
Replacing with ifelse in dplyr | replace_if.R |
Relevant to hw2: Fixing problems in read_csv with col_types | read_csv_specifications.R |
Multiple Summarization (mean/sd) and summarize with quantile | mean_sd_number_of_non_missing.R |
Changing Factors in Stata file | stata_factors.R |
Tables and Figures in RMarkdown | tables_and_plots.Rmd |
Day | Link to Video |
---|---|
Data Summarization | https://youtu.be/l-r4RBhNDDo |
Day | Link to Video |
---|---|
Day 1 | https://youtu.be/Xi-wsACc7p0 |
Day 2 | https://youtu.be/u1FQt9Hr8iw |
Day 3 | https://youtu.be/woc7AGJTzZw |
Day 4 | https://youtu.be/RZ7eVIMPIes |
Day 5 | https://youtu.be/e8cFV8wluC0 |
Day | Link to Video |
---|---|
Day 1: Part 1 | https://youtu.be/QdD6x3tDI5Y |
Day 1: Part 2 | https://youtu.be/GMBfu_bnKOI |
Day 2 | https://youtu.be/NQFAoxX-w74 |
Day 3: Part 1 | https://youtu.be/OEv1ZZXvToY |
Day 3: Part 2 | https://youtu.be/OEbgC3A5vKw |
Day 4: Part 1: Strings | https://youtu.be/D6QDXDlKaWs |
Day 4: Part 2: Strings | https://youtu.be/8pVPMZugn6E |
Day 5 |
tidyverse
always loaded?In R
, if you have never set an Renviron
before, you can make tidyverse
load whenever you start R
as follows:
filename = "~/.Renviron"
x = ""
if (file.exists(filename)) {
x = readLines(filename)
}
have_r_pack = grepl("R_DEFAULT_PACKAGES", x)
if (any(have_r_pack)) {
stop("add R_DEFAULT_PACKAGES to .Renviron manually!")
} else {
x = c('R_DEFAULT_PACKAGES="tidyverse"', x)
writeLines(x, con = filename)
}
For reproducibility, you should still have library(tidyverse)
at the top of your scripts so that if someone else (or you if you change computers) try to run the code, the code should still work. If you forget that, then the code is not reproducible and can be quite difficult to find this as the source of the problem.
Feel free to submit typos/errors/etc via the github repository associated with the class: https://github.com/muschellij2/intro_to_r
This page was last updated on 2018-02-20 14:55:50 Eastern Time.
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.