-
Notifications
You must be signed in to change notification settings - Fork 1
/
data.Rmd
47 lines (32 loc) · 2.75 KB
/
data.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
---
title: "Data"
output:
html_document:
toc: false
---
```{r, include=FALSE}
library(knitr)
knitr::opts_chunk$set(message=FALSE, warning=FALSE, eval=TRUE, echo=FALSE)
suppressPackageStartupMessages(library(dplyr))
```
```{r zipdir, include=FALSE}
if (!file.exists("data/all_data.zip")) system("rm data/all_data.zip ; zip -r data/all_data.zip data -x '*.html' -x '*.DS_Store'")
```
\
**Option 1: Download all the data at once.**
- Create a new RStudio project for this course (call it 'pgr_stats' if your imagination fails you!). If you're not sure how to create a new Project then see [Section 1.6](https://intro2r.com/rsprojs.html) of our Introduction to R book or watch [this short video](https://alexd106.github.io/QUADstatR/howto.html#rstudio_proj-vid).
- Once you're working in your RStudio project create a new directory in your Project directory called `data` (all lowercase). You can easily create this new directory by clicking on the 'New Folder' button in the 'Files' tab in RStudio (see [Section 1.8](https://intro2r.com/dir-struct.html) of our Introduction to R book for a set-by-step guide how to do this).
- Download and extract **[this zip file <i class="fa fa-file-archive-o" aria-hidden="true"></i>](data/all_data.zip)** `r paste0("(", round(file.info("data/all_data.zip")$size/1e6, 2), " Mb)")` with all the data for the entire workshop in the new `data` directory you just made. Note: this file may include additional datasets that we won't use. You will need to uncompress this zip file using your favourite software (most operating systems now have at least one built-in (un)compression tool).
\
**Option 2: Download individual datasets as needed.**
- Create a new RStudio project for this course (call it 'pgr_stats' if your imagination fails you!). If you're not sure how to create a new Project then see [Section 1.6](https://intro2r.com/rsprojs.html) of our Introduction to R book or watch [this short video](https://alexd106.github.io/QUADstatR/howto.html#rstudio_proj-vid).
- Once you're working in your RStudio project create a new directory in your Project directory called `data` (all lowercase). You can easily create this new directory by clicking on the 'New Folder' button in the 'Files' tab in RStudio (see [Section 1.8](https://intro2r.com/dir-struct.html) of our Introduction to R book for a set-by-step guide how to do this).
- Download individual data files as needed, saving them to the new `data` folder you just made. Right click on the data file link below and select _Save link as..._ (or similar) to save to the desired location.
```{r, results='asis'}
dir <- "data/"
list.files(dir) %>%
sort %>%
grep("\\.html$ | *.zip", ., value=TRUE, invert=TRUE) %>%
paste0(" + [", ., "](", paste0(dir, .), ")") %>%
cat(sep="\n")
```