Skip to content

Commit 9b5894b

Browse files
committed
merge
Merge branch 'traits_tutorials' of github.com:terraref/tutorials into traits_tutorials # Conflicts: # traits/06-agronomic-metadata.Rmd
2 parents 2b028c1 + abd27c3 commit 9b5894b

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

traits/06-agronomic-metadata.Rmd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Here are some key tables and fields that we will look at:
7171
| management_id | managements.id |
7272

7373

74-
```{r 06-setup, include = FALSE}
74+
```{r tutorial-06-set-up, include = FALSE}
7575
7676
library(dplyr)
7777
library(tidyr)
@@ -81,15 +81,15 @@ library(rgeos)
8181
library(leaflet)
8282
year <- lubridate::year
8383
84-
options(betydb_key = readLines('.betykey', warn = FALSE),
84+
options(betydb_key = readLines('traits/.betykey', warn = FALSE),
8585
betydb_url = "https://terraref.ncsa.illinois.edu/bety/",
8686
betydb_api_version = 'v1')
8787
8888
```
8989

9090

9191

92-
```{r}
92+
```{r 06_tibble, echo = TRUE, warning = FALSE}
9393
## query and join tables
9494
species <- betydb_query(table = "species") %>%
9595
select(specie_id = id, scientificname, genus)
@@ -132,7 +132,7 @@ Let's do the manual equivalent of a cross-table join. BETY actually does contain
132132

133133
The key idea here is that each treatment is associated with some (possibly many) managements, but the treatments table only reports the number of associated managements. To see the management IDs themselves, we need to query an individual treatment ID. So, we retrieve one table, then iterate over each row extracting the foreign keys for the other table. This requires an API call for every treatment, so beware that it is likely to be slow!
134134

135-
```{r}
135+
```{r 06_cross_join, echo = TRUE, results = 'hide'}
136136
treatments <- betydb_query(table = 'treatments') %>%
137137
select(treatment_id = id , name, definition, control)
138138

0 commit comments

Comments
 (0)