spdgt.core provides cached reference data lookups and spatial data access for the SpeedGoat count API. It sits on top of spdgt.auth and is part of the SpeedGoat R ecosystem.
Installation
Install from the SpeedGoat Nexus repository:
install.packages(
"spdgt.core",
repos = c(SPDGT = "https://nexus.spdgt.com/repository/public-group/")
)To make SpeedGoat Nexus repository always available edit your .Rprofile to include:
Authentication
spdgt.core requires an authenticated session through spdgt.auth. See the spdgt.auth documentation for setup instructions.
Usage
Cached lookups
The lookup system caches reference data locally so repeated calls are fast.
library(spdgt.core)
# Build the cache (fetches all lookup tables)
build_cache()
# Species lookups
lkup_species()
lkup_species_opts() # named vector for Shiny selectInput
lkup_species_id("Mule Deer") # resolve name to id
# Spatial unit lookups
lkup_gmu(species_id = 1)
lkup_dau(species_id = 1)
lkup_dau_opts(species_id = 1)Direct API reads
Read functions query the API directly and return tibbles.
# Tabular data
lkup_read_region()
lkup_read_gmu(species_id = 1)
lkup_read_subunit(dau_id = 10)
# Spatial data (returns sf objects)
lkup_read_region_sf(geometry = "polygon")
lkup_read_gmu_sf(species_id = 1, geometry = "point")Sharing data
Share functions return authenticated download URLs.
lkup_share_region(format = "csv")
lkup_share_gmu(format = "parquet", species_id = 1)
lkup_share_subunit(format = "json", geometry = "polygon")Related packages
All publicly available SpeedGoat packages can be explored at our Developer Portal