Fork me on GitHub

JHSPH

Instructors:

TAs

Class:

Grading

  1. Attendance/Participation: 20%
  2. Nightly Homework: 3 x 15%
  3. Final “Project”: 35%

Submitting Homework

Please go to https://courseplus.jhu.edu/, sign in, go to the Intro to R class, and then go to Drop Boxes to submit homework and projects.

Example Projects

This project should entail reading in a dataset of your choosing, doing some light data cleaning, performing some data summarization and visualization, and then doing some very light statistical analysis, like regression or chi-squared tests. Example projects can be found with the source code: Rmd, and the output Docx here.

Example knitr

Rmd and html output

All the Requirements in this Course

Packages

We have an R package called jhur that will make sure all the packages are installed.

install.packages("remotes")
remotes::install_github("muschellij2/jhur")

Alternatively, 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.

Functions

All the functions used (in any way - homework, lecture, lab), are listed in this Google doc, which can start a kind of cheat sheet for you.

Data

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.

Schedule

Module Slides Code Resource In Class Work
Day 0
Homework 1 Code Academy
Day 1
Intro HTML, PDF R, Rmd
RStudio HTML, PDF R, Rmd Lab, Key, Key HTML
Basic R HTML, PDF R, Rmd Lab, Key, Key HTML
Data IO HTML, PDF R, Rmd Lab, Key, Key HTML
Homework 2 Rmd, HTML, Key, Key HTML
Day 2
Subsetting Data in R HTML, PDF R, Rmd Lab, Key, Key HTML
Data Summarization HTML, PDF R, Rmd Lab, Key, Key HTML
Day 3
Data Classes HTML, PDF R, Rmd Lab, Key, Key HTML
Data Classes summary HTML, PDF R, Rmd
Data Cleaning HTML, PDF R, Rmd Lab, Key, Key HTML Live R file
Homework 3 Rmd, HTML, Key, Key HTML
Day 4
Manipulating Data in R HTML, PDF R, Rmd Lab, Key, Key HTML Live R file
Data Visualization HTML, PDF R, Rmd Lab, Key, Key HTML Live R file
Day 5
Statistics HTML, PDF R, Rmd Lab, Key, Key HTML Live R file
Functions HTML, PDF R, Rmd
Knitr HTML, PDF R, Rmd

Additional Resources

Live Code Examples

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

PDF of black and white theme

Shiny and Knitr Docs

Online Videos of Lectures

From Winter Institute 2020

Day Link to Video
RStudio and Data Classes https://www.youtube.com/watch?v=vyIsDnsq5jY
Subsetting Data https://youtu.be/mT8lSagYbjM
Data Summarization Part 1 https://www.youtube.com/watch?v=SZYpzt9zy0g
Data Classes https://www.youtube.com/watch?v=82zSA1N0mnA
Statistics https://www.youtube.com/watch?v=Jr4ljyzrr4U

From Winter Institute 2018

Day Link to Video
Data Summarization https://youtu.be/l-r4RBhNDDo

From Summer Institute 2 2017

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

Find an Error!?

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 2020-11-17.

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.