| assoc_ad | R Documentation |
Intelligently bind together data from AREAdata and other sources at a given spatial scale.
assoc_ad(
data,
areadata,
targetdate = NA,
enddate = NA,
gid = 0,
lonlat_names = c("Longitude", "Latitude"),
cache_location = NULL,
basereq = ad_basereq()
)
data |
the source data to bind AREAdata to. This must contain decimal lonlat data! |
areadata |
the AREAdata to bind, usually from |
targetdate |
ONE OF the following:
|
enddate |
The (exclusive) end of the range of dates to search for. If this is unfilled, only the |
gid |
the spatial scale to retrieve (0 = country-level, 1=province-level...). (Note: this will preferentially use the gid level of |
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 |
basereq |
the url of the AREAdata database (usually generated by |
A matrix of the data with added columns extracted from areadata.
The date range is a partially open interval. That is to say the lower bound (targetdate) is inclusive, but the upper bound (enddate) is exclusive.
For example a date range of "2020-08-04" - "2020-08-12" will return the 7 days from the 4th through to the 11th of August, but not the 12th.
In cases where a full date is not provided, the earliest date possible with the available data is chosen.
So "2020-04" will internally become "2020-04-01".
If an incomplete date is specified as the targetdate and no enddate is specified, the range to search is inferred from the minimum temporal scale provided in targetdate.
For example "2020-04" will be taken to mean the month of April in 2020, and the enddate will internally be set to "2020-05-01".
Francis Windram
vtdf <- search_hub("Aedes aegypti", "vt") |>
tail(20) |>
fetch() |>
glean(cols = c(
"DatasetID",
"Latitude",
"Longitude",
"Interactor1Genus",
"Interactor1Species"
), returnunique = TRUE)
areadata <- fetch_ad(metric="temp", gid=2, use_cache=TRUE)
ad_extract_working <- assoc_ad(vtdf, areadata,
targetdate = c("2021-08-04"), enddate=c("2021-08-06"),
gid=2, lonlat_names = c("Longitude", "Latitude"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.