/
setup.Rmd
63 lines (50 loc) · 1.58 KB
/
setup.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
---
title: "Setup for Divvy data analysis"
author: "Peter Carbonetto"
output: workflowr::wflow_html
---
```{r knitr-opts, include=FALSE}
knitr::opts_chunk$set(comment = "#",collapse = TRUE)
```
To reproduce the results on your own computer, please follow these
setup instructions.
## Setup instructions
Download or clone the
[git repository](https://github.com/stephenslab/wflow-divvy)
on your computer.
Download the Divvy data files and copy the files to the "data"
directory. I 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](http://cran.r-project.org) and/or
[Rstudio](https://www.rstudio.com/products/rstudio).
Install the R packages used for the analyses:
```{r install-pkgs, eval=FALSE, echo=TRUE}
install.packages(c("data.table","ggplot2"))
```
Once you have completed these steps, you may run the R code. When
running the code, make sure your working directory is set to the
"analysis" directory, e.g.,
```{r working-dir}
cat("Checking directory.\n")
getwd()
```
## Plotting test
```{r plot-test, fig.width=3, fig.height=4}
library(ggplot2)
ggplot(cars,aes(x = speed,y = dist)) +
geom_point(shape = 20)
```