Setup for Divvy data analysis

authors: Peter Carbonetto, Gao Wang
date: July 13, 2017

To reproduce the results on your own computer, please follow these setup instructions.

Setup instructions

  • Download the Divvy data files and copy the files to the "data" directory. We have provided a script code/retrieve_divvy_data.sh that will automatically retrieve the data files and move them to the expected location. Alternatively, you can view this script and follow the steps by hand. After completing this step, these files should be in the data directory:
Divvy_Stations_2016_Q1Q2.csv
Divvy_Stations_2016_Q3.csv
Divvy_Stations_2016_Q4.csv
Divvy_Trips_2016_04.csv
Divvy_Trips_2016_05.csv
Divvy_Trips_2016_06.csv
Divvy_Trips_2016_Q1.csv
Divvy_Trips_2016_Q3.csv
Divvy_Trips_2016_Q4.csv
  • Install R.
  • Optionally, install Jupyter. The recommended way to do this is to download and install Anaconda. This is only needed if you would like to run the code interactively within the Jupyter notebooks.
  • Install the R packages used for the analyses:
install.packages(c("repr","data.table","ggplot2"))

Once you have completed these steps, you are ready to run the R code. There are several ways this can be done.

One simple way is to run the individual code chunks by copying and pasting into the R console. When running the code in this way, make sure your working directory is set to the "analysis" directory, e.g.,

In [1]:
setwd("../analysis")
getwd()
'/Users/pcarbo/git/ipynb-website/analysis'

Alternatively, you can open the notebooks in Jupyter and run the code interactively.

Session information

This is the version of Jupyter that was used to generate the results from the notebooks.

In [2]:
system("jupyter --version",intern = TRUE)
'4.3.0'

This is the version of R and the packages that were used to generate the results from the Jupyter notebooks.

In [3]:
sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: macOS Sierra 10.12.5

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] R6_2.2.0        magrittr_1.5    IRdisplay_0.4.4 pbdZMQ_0.2-5   
 [5] tools_3.3.2     crayon_1.3.2    uuid_0.1-2      stringi_1.1.2  
 [9] IRkernel_0.7    jsonlite_1.5    stringr_1.2.0   digest_0.6.12  
[13] repr_0.12.0     evaluate_0.10.1

© 2017 Peter Carbonetto & Gao Wang