Skip to contents

Calls the sightability API to retrieve formatted observation data without running the model estimation. Useful for data validation and review before running the full model.

Usage

sight_prep_data(
  species,
  bio_year,
  analysis_unit,
  survey_type,
  model,
  filter_species = TRUE,
  filter_survey_type = TRUE,
  ...
)

sight_prep_data_id(
  species_id,
  bio_year,
  analysis_unit_id,
  survey_type_id,
  model_id,
  dry_run = FALSE,
  ...
)

Arguments

species

Character. Species name.

bio_year

Integer. Biological year.

analysis_unit

Character. Analysis unit name.

survey_type

Character. Survey type name.

model

Character. Model name.

filter_species

logical, if FALSE species is only used for lookup context and not passed as a filter (default TRUE)

filter_survey_type

logical, if FALSE survey_type is only used for lookup context and not passed as a filter (default TRUE)

...

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

species_id

Integer. Species identifier.

analysis_unit_id

Integer. Analysis unit identifier.

survey_type_id

Integer. Survey type identifier.

model_id

Integer. Sightability model identifier.

dry_run

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

Value

A tibble of prepared observation data with context columns (species_id, bio_year, analysis_unit_id, survey_type_id, model_id) followed by the observation and design columns. Key observation columns:

entry_id

Integer. Unique identifier for the observation.

subunit_id, subunit

Subunit identifier and name.

stratum_id, stratum

Stratum identifier and name.

is_selected, is_surveyed

Logical. Whether subunit was selected/surveyed.

total, males, females, youngs, unclass

Integer. Count columns.

activity, vegetation_type

Character. Observation covariates.

su_available, su_sampled, prop_sampled

Design columns added during preparation.

pkkp

Numeric. Sightability correction factor (classical models only).

See also

Examples

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

# Using IDs
sight_prep_data_id(
  species_id = 1,
  bio_year = 2024,
  analysis_unit_id = 355,
  survey_type_id = 9,
  model_id = 1
)
} # }