Skip to contents

Read beta coefficient value(s)

Usage

sight_read_betas(
  id = NULL,
  model = NULL,
  species = NULL,
  survey_type = NULL,
  filter_species = TRUE,
  filter_survey_type = TRUE,
  sort = NULL,
  pages = list(omit = 1),
  includes = NULL,
  ...
)

sight_read_betas_id(
  id = NULL,
  model_id = NULL,
  survey_type_id = NULL,
  sort = NULL,
  pages = list(omit = 1),
  includes = NULL,
  dry_run = FALSE,
  ...
)

Arguments

id

unique identifier of the beta coefficient

model

unique name of the model

species

species name, required if survey_type is provided

survey_type

unique name of the survey type

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)

sort

a character vector of fields to sort by, see details

pages

a list of pagination options, see details

includes

a character vector of related resources to include, see details

...

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

model_id

unique identifier of the model

survey_type_id

unique identifier of the survey type

dry_run

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

Value

A tibble with columns:

id

Integer. Unique identifier for the beta coefficient.

covar_id

Integer. Identifier for the associated covariate.

covar_value

Integer. Specific covariate value (for categorical), or NA.

beta_value

Numeric. The coefficient value.

created_at, updated_at

Character. Timestamps (may be NA).

covar

List column (when includes = "covar"). Nested tibble with covariate details including name, type, and mapping information.

Details

The pages argument is a named list with the following options:

  • omit: page number to omit, default is 1 which returns all records

  • size: number of records to return

  • number: the page number to return given the size

The includes argument is a character vector of related resources to include. Valid values are:

  • covar: include covariate details

The sort argument is a named list where names are fields to sort by.

See also

lkup_model_id(), lkup_survey_type_id() for converting names to IDs

Examples

if (FALSE) { # \dontrun{
# Read all beta coefficients
sight_read_betas()

# Read beta coefficients for a model that doesn't exit...this combination
# may exist in your project, but is meant to show an example of no results
# which is a tibble with 0 rows and 0 columns, not an error
sight_read_betas(species = "Bighorn Sheep", survey_type = "Sightability")

# Read beta coefficients for a model name
sight_read_betas(model = "Mule Deer")

# Read beta coefficients for a survey type name
sight_read_betas(species = "Mule Deer", survey_type = "Sightability")

# Read beta coefficients for a model ID
sight_read_betas_id(model_id = 1)

# Add useful information to the covariates such as model name and covariate
# name. It is suggested to use something like tidyr::unnest() to expand the
# nested tibble columns with argument names_sep = ".".
sight_read_betas(model = "Mule Deer", includes = c("covar")) |>
  tidyr::unnest(c(covar), names_sep = ".")
} # }