Skip to contents

These functions resolve various identifiers such as species, age class, GMU, and DAU based on provided names or IDs. They are useful for ensuring that the correct identifiers are used in subsequent operations, especially when working with the SPDGT API.

Usage

resolve_species(species_name = NULL, species_id = NULL)

resolve_age(age_class = NULL, age_class_id = NULL, species_id)

resolve_latest_dau_version(species_id)

resolve_gmu(gmu_name = NULL, gmu_id = NULL, species_id = NULL)

resolve_dau(dau_name = NULL, dau_id = NULL, species_id = NULL)

resolve_aircraft(aircraft_name = NULL, aircraft_id = NULL)

resolve_survey_type(
  survey_type_name = NULL,
  survey_type_id = NULL,
  species_id = NULL
)

resolve_strata(strata_name = NULL, strata_id = NULL, survey_type_id = NULL)

resolve_model(model_name = NULL, model_id = NULL)

resolve_ipm_param(
  param_name = NULL,
  param_id = NULL,
  target = NULL,
  species_id = NULL
)

Arguments

species_name

Optional character, name of species

species_id

Optional integer, ID of species

age_class

Optional character, name of age class

age_class_id

Optional integer, ID of age class

gmu_name

Optional character, name of GMU

gmu_id

Optional integer, ID of GMU

dau_name

Optional character, name of DAU

dau_id

Optional integer, ID of DAU

aircraft_name

Optional character, name of aircraft

aircraft_id

Optional integer, ID of aircraft

survey_type_name

Optional character, name of survey type

survey_type_id

Optional integer, ID of survey type

strata_name

Optional character, name of strata

strata_id

Optional integer, ID of strata

model_name

Optional character, name of model

model_id

Optional integer, ID of model

param_name

Optional character, name of IPM parameter

param_id

Optional integer, ID of the IPM parameter

target

Optional character, name of the target of the IPM Parameter in the IPM

Value

All resolve functions follow the same pattern:

  • If the ID argument is provided, it is returned as-is (integer, passthrough).

  • If the name argument is provided, an integer vector of matching IDs is returned. This can be length > 1 if the name matches multiple records.

  • If both name and ID are NULL, returns NULL (no filtering).

  • If a name cannot be resolved, the function aborts with an error and suggests similar names via fuzzy matching.

resolve_latest_dau_version() is different: it always returns a single integer (the maximum version ID for the species) or NULL if no versions exist.

Details

  • resolve_species: Resolves species by name or ID.

  • resolve_age: Resolves age class by name or ID for a given species.

  • resolve_latest_dau_version: Resolves the latest DAU version for a given species.

  • resolve_gmu: Resolves GMU by name or ID, optionally filtering by species.

  • resolve_dau: Resolves DAU by name or ID, optionally filtering by species.

  • resolve_aircraft: Resolves aircraft by name or ID.

  • resolve_survey_type: Resolves survey type by name or ID for a given species.

  • resolve_strata: Resolves strata by name or ID for a given survey type.

  • resolve_model: Resolves model by name or ID.

  • resolve_ipm_param: Resolves IPM parameters by name or ID for a given species or target.

Examples

if (FALSE) { # \dontrun{
# Resolve species by name
resolve_species(species_name = "Mule Deer")

# Resolve species by ID
resolve_species(species_id = 123)
} # }