assoc_gadm: Associate other data sources with gadm IDs

View source: R/assoc_gadm.R

assoc_gadmR Documentation

Associate other data sources with gadm IDs

Description

Intelligently bind together data with gadm IDs at all scales.

Usage

assoc_gadm(
  df,
  lonlat_names = c("Longitude", "Latitude"),
  cache_location = NULL,
  basereq = ad_basereq()
)

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!

cache_location

path to cache location (defaults to a temporary user directory, or one set by set_default_ohvbd_cache()).

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(s)

Francis Windram

Examples


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"))



ohvbd documentation built on March 10, 2026, 1:07 a.m.