Sta 323
Spring 2018
  Statistical Programming


Date Lecture Readings Notes
Tue, Jan 9 Introduction Enrollment Survey
Tue, Jan 16 Logic in R RStudio OIT VM
Thu, Jan 18 Class canceled - snow day
Fri, Jan 19 Using git and github HW1 - due Mon, Jan 29th by 11:59 pm
Tue, Jan 23 Vectors & Types
Thu, Jan 25 Data Structures & Subsetting
Tue, Jan 30 dplyr HW2 - due Tue, Feb 6th by 11:59 pm
RStudio Server: gort
Thu, Feb 1 No class
Tue, Feb 6 tidyr & purrr HW3 - due Tue, Feb 20th by 11:59 pm
Thu, Feb 8 More purrr
Tue, Feb 13 ggplot2
Thu, Feb 15 Visualization Angela & Eric's slides
Tue, Feb 20 Text data & Regular expressions Interactive RegEx tool
Thu, Feb 22 Web scraping (pt. 1) Exercise code
Tue, Feb 27 Web scraping (pt. 2) HW4 - due Fri, Mar 9th by 11:59 pm
Thu, Mar 1 Make
Tue, Mar 6 Parallelization
Thu, Mar 8 Web APIs
Tue, Mar 13 No class - Spring recess
Thu, Mar 15 No class - Spring recess
Tue, Mar 20 Shiny
Thu, Mar 22 Reactive Data
Tue, Mar 27 Profiling
Thu, Mar 29 Databases & sql
Tue, Apr 3 Bigish data
Thu, Apr 5 Spatial data HW6 - due by 11:59 pm on Thursday, April 19th
Tue, Apr 10 Precinct boundaries (pt. 1) Session Reset Video
Thu, Apr 12 Precinct boundaries (pt. 2)
Tue, Apr 17 SparklyR Midterm 2 out - due Friday April 27th by 11:59 pm
Thu, Apr 19 SparklyR & text data
Tue, Apr 24 Exam workday
Thu, May 3 Final Project due by 11:59 pm


Lectures & Lab:

The goal of both the lectures and the labs is for them to be as interactive as possible. My role as instructor is to introduce you new tools and techniques, but it is up to you to take them and make use of them. Programming is a skill that is best learned by doing, so as much as possible you will be working on a variety of tasks and activities throughout each lecture / lab. Attendance will not be taken during class but you are expected to attend all lecture and lab sessions and meaningfully contribute to in-class exercises and homework assignments.


Perkins Link 071 (Classroom 5),

  • Lecture - Tuedays & Thurdays 01:25 pm - 02:40 pm
  • Lab - Fridays 01:25 pm - 02:40 pm


  • Monday, January 15 - Martin Luther King, Jr. Day
  • Monday, March 12 to Friday, March 16 - Spring Break


To construct functional and diverse teams, you will be asked to complete a short survey to gage your previous exposure to programming topics. After completing the survey, you will be assigned to teams of ~3-4 students - these teams will not change throughout the semester (barring extraordinary circumstances). You will work in these teams during class and on the homework assignments. Only the take home exams will be completed individually.


Beyond the in class activities, you will be assigned larger programming tasks throughout the semester (roughly every other week). These assignments will be completed collaboratively by your team. All team members are expected to contribute equally to the completion of each assignment and you will be asked to evaluate your team members after each assignment is due.

Students are expected to make use of their team's git repository on the course's github page as their central collaborative platform. Commits to this repository will be used as a metric of each team member's relative contribution for each homework.

Final Project:

You will form your own team of 3-5 students and will be responsible for the completion of an open ended final project for this course, the goal of which is to tackle an "interesting" problem using the tools and techniques covered in this class. Additional details on the project will be provided as the course progresses. You will give a 15 minute presentation on your final project in class.


There will be a two take home midterms that you are expected to complete individually. Each exam will ask you to complete a number of small programming tasks related to the material presented in the class. The exams will be written to between 2-5 hours long. The exact structure and content of the exams will be discussed in more detail before they are assigned.

Course Announcements:

I will regularly send course announcements by email, make sure to check your email daily. Email is the easiest way to reach me outside of class, note that it is much more efficient to answer most questions in person.

Academic integrity:

Duke University is a community dedicated to scholarship, leadership, and service and to the principles of honesty, fairness, respect, and accountability. Citizens of this community commit to reflect upon and uphold these principles in all academic and non-academic endeavors, and to protect and promote a culture of integrity. Cheating on exams or plagiarism on homework assignments, lying about an illness or absence and other forms of academic dishonesty are a breach of trust with classmates and faculty, violate the Duke Community Standard, and will not be tolerated. Such incidences will result in a 0 grade for all parties involved. Additionally, there may be penalties to your final class grade along with being reported to the Undergraduate Conduct Board.

Please review the Academic Dishonesty policies here.

A note on sharing / reusing code - I am well aware that a huge volume of code is available on the web to solve any number of problems. Unless I explicitly tell you not to use something the course's policy is that you may make use of any online resources (e.g. StackOverflow) but you must explicitly cite where you obtained any code you directly use (or use as inspiration). Any recycled code that is discovered and is not explicitly cited will be treated as plagiarism. The one exception to this rule is that you may not directly share code with another team in this class, you are welcome to discuss the problems together and ask for advice, but you may not send or make use of code from another team.

Excused Absences:

Students who miss a class due to a scheduled varsity trip, religious holiday or short-term illness should fill out an online NOVAP, RHoliday or short-term illness form respectively. Note that these excused absences do not excuse you from assigned homework, it is your responsibility to make alternative arrangements to turn in any assignments in a timely fashion.

Those with a personal emergency or bereavement should speak with your director of graduate studies or your academic dean.

Late work policy:

  • late, but same day: -10%
  • late, next day: -20%
  • 2 days or later: no credit


Your final grade will be comprised of the following.

  • Homework: 50%
  • Midterms: 40%
  • Final Project: 10%

The exact ranges for letter grades will be curved and cutoffs will be determined at the end of the semester. The more evidence there is that the class has mastered the material, the more generous the curve will be.


There are no required textbooks for this course, the following textbooks are recommended for supplementary and reference purposes.

  • Advanced R - Wickham - Chapman and Hall/CRC, 2014 (978-1466586963)
  • R Packages - Wickham - O'Reilly, 2015 (978-1491910597)
  • R for Data Science - Grolemund, Wickham - O'Reilly, 2016 (978-1491910399)

Contact Information

Office Hours:

  • Prof. Rundel - 204 Old Chemistry - Wednesday, 2:00 - 4:00 pm or by appointment
  • Abbas Zaidi - 211A Old Chemistry - Thursday, 5:30 - 7:30 pm
  • Lisa Lebovici - 211A Old Chemistry - Tuesdays 11:00 am - 12:00 pm and Thursdays 10:00 - 11:00 am

Recommended Software

Text Editor

When you're writing code, it is nice to have a text editor that is optimized for writing code. There is a huge variety of options out there, if you do not already have a preferred editor try and few and see which one works best for you.

  • vim / emacs - old school unix console based editors, they have a steep learning curve but are incredibly powerful.
  • nano - another unix console editor, easier learning curve but with much less power.
  • SublimeText - crossplatform GUI text editor with a robust plugin ecosystem.


Git is a state-of-the-art version control system. It lets you track who made changes to what when and has options for easily updating a shared or public version of your code on github.

  • OSX - install Git for Mac by downloading and running the installer or install homebrew and use it to install git via brew install git.
  • Unix / Linux - you should be able to install git via your prefered package manager (if it is not already installed).
  • Windows - install Git for Windows by download and running the git for windows installer. This will provide you with git, the bash shell, and ssh in windows.

Unix shell(s) / ssh

We will be doing much of the work in the class on remote linux systems, primarily we will be interacting with these machine through a remote terminal and a shell. Using a shell gives you more power to do more tasks more efficiently with your computer.

  • OSX / Unix / Linux - these tools should already be installed and you should be able to access your shell through the Terminal application (name may vary slightly depending on your OS).
  • Windows - there are several ways to install bash or a bash-like shell, the preferred method is to install the git for windows package as detailed above.
  • s

R / RStudio

R is a programming language that is especially powerful for data exploration, visualization, and statistical analysis. To interact with R we will primarily be using RStudio, an interactive development environment (IDE), via a browser based interface. There is no need to install R or RStudio on your own laptop but doing so is recommended before the end of the semester.

About this website

This site is built with Hugo and Blogdown. The theme is based on Blackburn and Hugo Conference.

© 2018. All rights reserved.