Sta 523
Fall 2018
  Statistical Programming


Date Lecture Readings Notes
Mon, Aug 27 Introduction Enrollment Survey
Wed, Aug 29 Logic in R OIT RStudio VM
Thu, Aug 30 Data types in R
Mon, Sep 3 Using shell & git HW1 out - due Monday 09/10 by 1 pm.
Wed, Sep 5 Data Structures & Subsetting
Mon, Sep 10 DF Subsetting + S3 HW2 out - due Monday 09/17 by 1 pm. Wednesday 09/19 by 11:59 pm. Demo
Wed, Sep 12 dplyr
Mon, Sep 17 Rescheduled lab
Wed, Sep 19 tidyr & purrr
Thu, Sep 20 More purrr HW3 out - due 09/28 by 11:59 pm
Mon, Sep 24 ggplot2
Wed, Sep 26 Visualization Angela & Eric's Slides
Mon, Oct 1 Text data & Regular expressions
Wed, Oct 3 Web scraping (pt. 1)
Mon, Oct 8 No class - Fall recess
Wed, Oct 10 Web scraping (pt. 2)
Mon, Oct 15 Rescheduled lab day
Wed, Oct 17 Web scraping (pt. 3)
Thu, Oct 18 Make
Mon, Oct 22 Web APIs
Wed, Oct 24 Shiny
Mon, Oct 29 Reactive Data utf8splain
Wed, Oct 31 Profiling & Parallelization
Mon, Nov 5 Bigish data
Wed, Nov 7 Spatial data
Mon, Nov 12 Databases & sql
Wed, Nov 14 Spatial data + Modeling
Mon, Nov 19 No class - Thanksgiving
Wed, Nov 21 No class - Thanksgiving
Mon, Nov 26 SparklyR
Wed, Nov 28 SparklyR & text data
Sun, Dec 16 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 - Mondays & Wednesday 03:05 pm - 04:20 pm
  • Lab - Thursdays 01:25 pm - 02:40 pm


  • Monday, October 8 - Fall Recess
  • Wednesday, November 21 - Thanksgiving


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 either individually or in a team. For team based assignments, 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 the provided 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 be between 2-5 hours of work. 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:

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.