Skip to contents

sight_fit_model() resolves names to IDs then calls the sightability API. sight_fit_model_id() calls the API directly using integer IDs.

Usage

sight_fit_model(
  species,
  spatial_focus,
  bio_year,
  analysis_unit,
  survey_type,
  model,
  data = NULL,
  ...
)

sight_fit_model_id(
  species_id = NULL,
  spatial_focus,
  bio_year = NULL,
  analysis_unit_id = NULL,
  survey_type_id = NULL,
  model_id,
  data = NULL,
  dry_run = FALSE,
  ...
)

Arguments

species

Character. Species name (name-based variant only).

spatial_focus

Character. One of "DAU", "GMU", or "SubUnit".

bio_year

Integer. Biological year. For sight_fit_model_id(), required unless data is provided with a bio_year column.

analysis_unit

Character. Analysis unit name (name-based variant only).

survey_type

Character. Survey type name (name-based variant only).

model

Character. Model name (name-based variant only).

data

Optional data.frame of sightability data. If provided, the API will use this data directly instead of fetching from the database. The data.frame should contain columns for species_id, bio_year, analysis_unit_id, and survey_type_id if those parameters are not provided separately.

...

Additional arguments passed to the underlying spdgt.auth function (e.g., verbosity, timeout).

species_id

Integer. Species identifier (ID-based variant only). Required unless data is provided with a species_id column.

analysis_unit_id

Integer. Analysis unit identifier (ID-based variant only). Required unless data is provided with an analysis_unit_id column.

survey_type_id

Integer. Survey type identifier (ID-based variant only). Required unless data is provided with a survey_type_id column.

model_id

Integer. Sightability model identifier (ID-based variant only).

dry_run

If TRUE, print the HTTP request without sending it and return the request object invisibly. Useful for debugging.

Value

Tibble with context columns (species_id, bio_year, analysis_unit_id, spatial_focus, survey_type_id, model_id) followed by estimation columns (Demographic, RawCount, Estimate, SightInflation, SampInflation, TotalVar, etc.).

See also

Examples

if (FALSE) { # \dontrun{
# Using names
sight_fit_model(
  species = "Mule Deer",
  spatial_focus = "DAU",
  bio_year = 2024,
  analysis_unit = "North Converse 755",
  survey_type = "Sightability",
  model = "Mule Deer"
)

# Using IDs
sight_fit_model_id(
  species_id = 1,
  spatial_focus = "DAU",
  bio_year = 2024,
  analysis_unit_id = 272,
  survey_type_id = 3,
  model_id = 1
)

# Using custom data
sight_fit_model_id(
  spatial_focus = "DAU",
  model_id = 1,
  data = my_sightability_data
)
} # }