cont-limno / LAGOSNE

Interface to the LAke multi-scaled GeOSpatial & temporal database :earth_americas:
https://cont-limno.github.io/LAGOSNE/
15 stars 8 forks source link

allow users to input multiple 'scale' options in lagos_select #29

Closed limnoliver closed 7 years ago

limnoliver commented 7 years ago

Also allow multiple "categories". Currently, the example dt_reduced <- lagos_select(dt, scale = "HU4", category = c("waterquality", "deposition")) given in ?lagos_selectdoes not retrieve water quality data.

jsta commented 7 years ago

My vision for this workflow would be to find the relevant tables using:

??deposition
??waterquality

Then, under the new lagos_select setup, this query could be formulated as:

library(LAGOS)
library(dplyr)

dt <- lagos_load(version = "1.087.1")
wq  <- lagos_select(table = "epi.nutr", categories = "waterquality", vars = "lagoslakeid")
dep <- lagos_select(table = "hu4.chag", categories = "deposition", vars = "hu4_zoneid")
meta <- dt$locus[, c("lagoslakeid", "hu4_zoneid")]

res <- left_join(wq, meta)
res <- left_join(res, dep)