get_prepared_data: Get the prepared species dataset used for JAGS

View source: R/get-prepared-data.R

get_prepared_dataR Documentation

Get the prepared species dataset used for JAGS

Description

get_prepared_data returns a data frame of the data that was used for JAGS. This is the subsetted data based on the selected species to model, with zero counts filled in and any other route/strata filter applied.

Usage

get_prepared_data(jags_data = NULL)

Arguments

jags_data

List of JAGS input data produced by prepare_jags_data

Value

Data frame of 9 variables:

count

Number of species observed for this route run

strat

Numerical factors of the stratum

obser

Numerical factor of the observer

year

Numerical factor of the year

firstyr

1 if this was the observer's first year, 0 otherwise

strat_name

Name of the stratum

route

Route that this count was taken on

rYear

Year this count was conducted

yearscale

Scaled year

Examples

# Toy example with Pacific Wren sample data
# First, stratify the sample data

strat_data <- stratify(by = "bbs_cws", sample_data = TRUE)

# Prepare the stratified data for use in a JAGS model. In this
#   toy example, we will set the minimum year as 2009 and
#   maximum year as 2018, effectively only setting up to
#   model 10 years of data. We will use the "first difference
#   model.
jags_data <- prepare_jags_data(strat_data = strat_data,
                               species_to_run = "Pacific Wren",
                               model = "firstdiff",
                               min_year = 2009,
                               max_year = 2018)

# Obtain the reassembled data frame for the data sent to JAGS
prepped_data <- get_prepared_data(jags_data = jags_data)



BrandonEdwards/bbsBayes documentation built on Aug. 11, 2024, 9:33 a.m.