Intelligently bind together data with gadm IDs at all scales.
Usage
assoc_gadm(df, lonlat_names = c("Longitude", "Latitude"), basereq = NA)
Arguments
- df
the source data to bind gadm IDs to. This must contain decimal lonlat data!
- lonlat_names
a vector containing the column names of the longitude and latitude columns IN THAT ORDER!
- basereq
the url of the AREAdata database (usually generated by
ad_basereq()
). IfNA
, uses the default.
Caching
This will ALWAYS get and cache gid level 2 data sources. These files are about 80MB total, so if you are running on a metered connection do beware of this.
Examples
if (FALSE) { # \dontrun{
vt_ids <- search_vt(c("Aedes", "aegypti"))
vtdf <- fetch_vt(vt_ids[(length(vt_ids)-20):length(vt_ids)]) %>%
extract_vt(cols = c(
"DatasetID",
"Latitude",
"Longitude",
"Interactor1Genus",
"Interactor1Species"
), returnunique = TRUE)
vtdf <- vtdf %>% assoc_gadm(lonlat_names = c("Longitude", "Latitude"))
} # }