generated from allisonhorst/meds-distill-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
week_2.Rmd
73 lines (39 loc) · 2.3 KB
/
week_2.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
64
65
66
67
68
69
70
71
---
title: "Week 2: Accessing data in a programmatic way"
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
# Monday 10/04/2021 -- Lecture
## Using APIs to programatically retrieve data
<br>
### The manual way
Using website to retrieve data is great interactive way to search and explore data of interest. Let's start our week by searching some data on the data repository DateONE: https://search.dataone.org/data
In case you need some inspiration, look at this dataset about historic precipitation in Alaska: https://doi.org/10.5063/N29VCQ
<br>
### The programmatic way
Although discovering data through a web interface is convenient and offers a great experience, it is often hard to scale this approach or to integrate it into a reproducible workflow.
**[Slides](https://brunj7.github.io/EDS-213-metadata/slides/api.html)**
# Wednesday 10/06/2021 -- Using APIs Lab
## USGS `dataRetrieval` R package to retrieve hydrological data
USGS is managing a vast [network of gauges](https://dashboard.waterdata.usgs.gov/app/nwd/?region=lower48&aoi=default) to monitor freshwater across the US.
### Exercise 1
Start a new Markdown document to plot the discharge time-series for the Ventura River from 2019-10-01 to 2020-10-05
Webpage: https://waterdata.usgs.gov/nwis/uv?site_no=11118500
Tutorial for the package can be found here:
https://cran.r-project.org/web/packages/dataRetrieval/vignettes/dataRetrieval.html#daily-data
### Bonus
How would you try to determine when this stream gauge record started using the API?
## `metajam`
The `metajam` R package relies on the dataONE API to download data **and** metadata into your R Environment. It is currently supporting KNB, ADC and EDI repositories because they rely on the metadata standard EML.
Short [intro](https://brunj7.github.io/EDS-213-metadata/slides/metajam_intro.html) to the package
### Exercise 2
Let's determine what percentage of Alaskan household are speaking only English!
The data: https://doi.org/10.5063/F1N58JPP
1. Read the metadata
2. Download the data `household_language.csv` using metajam
3. Read the data into R using metajam
4. Write a piece of code that will compute the percentage of Alaskan household speaking only English for the year 2009 to 2015
5. Create a plot to visualize this data
### Bonus
How does it compare to French?