Find us on GitHub

Intro to R - School of Global Policy and Strategy

Jan 4 - Jan 21, 2021

Zoom Tuesday, Thursday:12:30 pm -1:50 pm

Instructors: Rick Mccosh (OBGYN-Repro Sci), Stephanie Labou (Library)

Helpers: Chi Gao (TA-GPS), Reid Otsuji (Library), Kimberly Thomas(Research IT), Harry Zhao(Research IT)

General Information

This is the website for the School of Global Policy and Strategy skills course in the R programming language. This course will introduce you the R programming language and how to use R to work with data from GapMinder. In order to earn a certificate of proficiency, you must attend all of the class meetings for the course, do the short coding assignments, and pass the short, in-class quiz at the end of the course.

Who: The course is aimed at GPS graduate students. You don't need to have any previous knowledge of programming or the tools presented in the course to attend. A laptop is required for the class.

Where: School of Global Policy and Strategy, 9500 Gilman Drive, #0519, La Jolla, CA. Zoom - link and access information in Canvas

Requirements: Participants must bring a laptop with a few specific software packages installed (listed below).

Contact: Please mail rotsuji@ucsd.edu for more information.

Assessment: A certificate of proficiency will be given to the student who:

  • 20% Attends and participates in classes
  • 40% Passes all in-course quizzes
  • 40% Satisfactorily completes the weekly homework assignments

Need help?:

Data: We will be using the 5 year gapminder data. You can go ahead and set up a RStudio project and download the data following these instructions. The CSV can be downloaded from here.

Lecture notes & command histories:

Day 1 - Jan. 6, 2020

  • Notes: Intro to R & RStudio , Commands:R Script

Credits: The course materials are adpated from the Software Carpentry lessons. Many thanks to the authors of those lessons.


Schedule

Date Class Topics
Jan. 5 Lecture Intro to R & RStudio - basics
Jan. 7 Lecture data structures, skip matrices, data import/export
  Quiz & Assignment 1 Quiz 1 – Assignment 1 - posted in Canvas
Jan. 12 Lecture dplyr, tidyverse
Jan. 14 Lecture Cont.
  Quiz & Assignment 2 Quiz 2 – Assignment 2 - posted in Canvas
Jan. 19 Lecture Plotting with ggplot2
Jan. 21 Lecture ggplot2 cont., knitr
  Quiz & Assignment 3 Quiz 3 – Assignment 3 - posted in Canvas

HackMD: https://hackmd.io/3JeMSRvbRJ-ySHqvl_wS1A.
We will use this HackMD for taking notes, and sharing URLs and bits of code.


Syllabus

Programming in R

  • Working with vectors and data frames
  • Reading and plotting data
  • Creating and using functions
  • Reference...

Setup

To participate in this course, you will need access to the software described below. In addition, you will need an up-to-date web browser.

R

R is a programming language that is especially powerful for data exploration, visualization, and statistical analysis. To interact with R, we use RStudio.

Windows

Video Tutorial

Install R by downloading and running this .exe file from CRAN. Also, please install the RStudio IDE. Note that if you have separate user and admin accounts, you should run the installers as administrator (right-click on .exe file and select "Run as administrator" instead of double-clicking). Otherwise problems may occur later, for example when installing R packages.

Mac OS X

Video Tutorial

Install R by downloading and running this .pkg file from CRAN. Also, please install the RStudio IDE.

Linux

You can download the binary files for your distribution from CRAN. Or you can use your package manager (e.g. for Debian/Ubuntu run sudo apt-get install r-base and for Fedora run sudo yum install R). Also, please install the RStudio IDE.