NTRES 6100
Collaborative and Reproducible Data Science in R
Cornell University, Spring 2023

Course Info

Lectures: Tuesdays and Thursdays 9:40am - 10:55am (January 24 - March 31, 2023), Fernow Hall G24

Optional lab sessions: Thursdays or Fridays 12:25pm - 2:20pm, Fernow Hall G01

Instructor: Assistant Professor Nina Overgaard Therkildsen ()

TA: PhD Student Azwad Iqbal ()

Office hours: Nina: by appointment; Azwad: Tuesdays, 11:00am - 12:00pm in Fernow 210 or by appointment (Zoom link)

Grading: S/U (2 credits / 3 credits with lab)


Course description

As datasets grow larger and more complex across all areas of science, computational skills are increasingly in high demand. This course introduces a series of practical tools that enable researchers to spend less time wrestling with software or repeating error-prone manual data processing and more time getting research done in efficient and transparent ways that facilitate collaboration and reproducibility. We will work in R/RStudio, primarily with the tidyverse packages and with Git and GitHub integration. Topics covered include 1) tidy data formatting, 2) rearrangement, filtering, exploration, and visualization of complex datasets, 3) basic programming for building and automating custom tools, 4) tracking the history of file changes (version control) with Git and GitHub, 5) strategies for effective collaboration on data processing pipelines, and 6) using R Markdown to combine text, equations, code, tables, and figures into reports, websites, and presentations. The course emphasizes practical skill development and will be structured around hands-on (the keyboard) learning.


Learning outcomes

By the end of this course, students will be able to:

  • Describe strategies for ensuring that their data analysis is reproducible
  • Demonstrate best practices for coding and project-oriented workflows in RStudio
  • Import and clean messy data files using a variety of packages and functions in R
  • Subset, reorganize, and merge diverse datasets in R
  • Effectively explore and visualize patterns in complex datasets with ggplot in R
  • Write simple functions/programs and data analysis pipelines in R
  • Automate repeated analysis tasks in R
  • Track the history of file changes (version control) and collaborate effectively on scripts with others with Git and GitHub
  • Use R Markdown to combine text, equations, code, tables, and figures into reports, websites, and presentations

Prerequisites

A basic working knowledge of R will be helpful, but no prior experience with the tidyverse packages or with Git, GitHub, or R Markdown is assumed. If you have never worked in R before, we recommend working through one or more of the following tutorials before the course:


Course format

The two weekly lectures will introduce new concepts and provide opportunities to practice through hands-on exercises. To participate effectively, you must have completed the assigned readings prior to class. Each Thursday, we will assign a problem set that applies the concepts covered in class in a new context to reinforce your learning. The problem sets are due the following Thursday at 10pm. We offer two optional lab sessions on Thursdays and Fridays for more opportunities to practice in groups and with TA support; the Thursday and Friday sessions are identical and you can attend either one of them.


Evaluation

It takes practice to acquire and internalize data science skills, and what you get out of this course will be proportional to the effort you put in. Practice as much as you can. To pass, students are expected to attend all lectures (and lab sessions if enrolled), participate actively during class, submit at least 7 of the 9 problem sets with demonstrated effort to complete all questions, and give a brief (~2 minute) presentation at the end of the course about how you might adopt some of the course material in your own work. If you are unable to make a lecture or can not meet a problem set deadline, please let the instructor and TA know on Slack beforehand. If you are registered in one of the lab sessions (one extra credit), you are also expected to participate in lab activities in at least 7 of the 9 lab sessions.


Course materials

All assigned readings are freely available online and will be linked to from the course website. We will draw from a variety of sources, primarily Grolemund and Wickham’s R For Data Science and the STAT545 course developed by Jenny Bryan.

All students will need to bring a laptop to each session. Students who do not have their own laptop can arrange to borrow one from the Mann Library.

Please follow the instructions here to install the software we will need prior to the first class.


Code of conduct

We are dedicated to providing a welcoming and supportive environment for everyone, regardless of background, identity and prior experience level. Everyone in this course will be coming from a different place with different experiences and expectations. We will not tolerate any form of language or behavior used to exclude, intimidate, or cause discomfort. This applies to all course participants (instructor, students, guests). In order to foster a positive and professional learning environment, we encourage the following kinds of behaviors:

  • Use welcoming and inclusive language
  • Be respectful of different viewpoints and experiences
  • Gracefully accept constructive criticism
  • Show courtesy and respect towards others
  • Help each other - you may well learn something or reinforce your own skills in the process

Student accommodations

In compliance with the Cornell University policy and equal access laws, we are available to discuss appropriate academic accommodations that may be required for student with disabilities. Requests for academic accommodations are to be made during the first two weeks of the course, except for unusual circumstances, so arrangements can be made. Students are encouraged to register with Student Disability Services to verify their eligibility for appropriate accommodations.


Online participation

This semester, the course is offered fully in-person and we expect you to show up for class. However, in an effort to accommodate special needs and keep everyone safe and healthy, we will also provide a Zoom link for joining lectures online when you are not able to participate in-person. You can use the Zoom link posted on the the course Canvas site instead of showing up in person if you are sick, think you have been exposed to COVID19, or have another reasonable justification. However, we are not able to accommodate fully hybrid participation, and we strongly encourage you to participate in-person whenever possible. Online participation will not be possible for the lab sessions.


Tentative schedule

Subject to adjustment

Lecture# Day Date Topic Assignment due dates
1 Tue 1/24 Intro to the course and R/RStudio
2 Thu 1/26 Markdown and GitHub
3 Tue 1/31 The Git workflow (version control)
4 Thu 2/2 Collaborating with GitHub Part 1 Assignment 1
5 Tue 2/7 Collaborating with GitHub Part 2
6 Thu 2/9 Plotting with ggplot part 1 Assignment 2
7 Tue 2/14 Data wrangling part 1 (dplyr::filter, mutate, select, arrange)
8 Thu 2/16 Data wrangling part 2 (dplyr::summarize, group_by) Assignment 3
9 Tue 2/21 Plotting with ggplot part 2 + good coding practices
10 Thu 2/23 Tidy data Assignment 4
Tue 2/28 NO CLASS - February Break
11 Thu 3/2 Data import, export, and conversion between data types Assignment 5
12 Tue 3/7 Relational data
13 Thu 3/9 Good coding practices, debugging strategies, and getting help Assignment 6
Tue 3/14 SNOW DAY
14 Thu 3/16 Iteration (for loops) and conditional execution part 1 Assignment 7
15 Tue 3/21 Iteration (for loops) and conditional execution part 2
16 Thu 3/23 Functions
17 Tue 3/28 Factors in R
18 Thu 3/30 Student presentations, wrapping up and looking ahead Assignment 8
Tue 4/4 SPRING BREAK
Tue 4/6 SPRING BREAK
19 Tue 4/11 SNOW DAY MAKE-UP: Wrapping up and resources for learning more Assignment 9 (due 4/13)
Lab# Date (Thu) Date (Fri) Topic
1 1/26 1/27 RMarkdown
2 2/2 2/3 RMarkdown and GitHub
3 2/9 2/10 Displaying data visualization on a website
4 2/16 2/17 Data exploration with the gapminder dataset
5 2/23 2/24 Data exploration with the Titanic dataset
6 3/2 3/3 Data cleaning and tidy data
7 3/9 3/10 Relational data and tidy data
8 3/16 3/17 Iteration and conditional execution
9 3/23 3/24 Functions and iterations
10 3/30 3/31 OPTIONAL: Bring your own project