Skip to contents

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()). If NA, uses the default.

Value

A matrix of the data with added gadm columns.

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.

Author

Francis Windram

Examples

if (FALSE) { # interactive()
vtdf <- search_hub("Aedes aegypti", "vt") |>
  tail(20) |>
  fetch() |>
  glean(cols = c(
    "DatasetID",
    "Latitude",
    "Longitude",
    "Interactor1Genus",
    "Interactor1Species"
    ), returnunique = TRUE) |>
  assoc_gadm(lonlat_names = c("Longitude", "Latitude"))

}