stratify: Stratify raw Breeding Bird Survey data

View source: R/stratify.R

stratifyR Documentation

Stratify raw Breeding Bird Survey data

Description

Assigns each bird count data point and each route a strata based on its geographic location and the stratification as specified by the user.

Usage

stratify(
  by = NULL,
  sample_data = FALSE,
  bbs_data = NULL,
  lump_species_forms = TRUE,
  quiet = FALSE,
  stratify_by = NULL
)

Arguments

by

String argument of stratification type. Options are "state", "bcr", "latlong", "bbs_cws", "bbs_usgs"

sample_data

Should just sample data (just Pacific Wren) be used? Defaults to FALSE.

bbs_data

Raw BBS data saved as a list of 3 data frames. Not necessary if you have already run fetch_bbs_data

lump_species_forms

Logical, default is TRUE, indicating that for species with multiple forms, the "unidentified" form is replaced by the sum of observations for all forms (including the original unidentified obs). The underlying BBS database includes separate data for each form, and these separate forms are retained with their original names. The original unidentified category for observations that were not specific to a particular form are replaced by the combined observations. If the user wishes to keep the unidentified form separate, this can be set to FALSE

quiet

Should progress bars be suppressed?

stratify_by

Deprecated in favour of 'by'

Value

Large list (3 elements) consisting of:

bird_strat

Dataframe of stratified bird data

route_strat

Dataframe of stratified route data

species_strat

Dataframe of stratified species data

by

Argument used for stratification

Examples


# Toy examples using Pacific Wren sample data

# Stratify by CWS USGS stratifications
data_strat <- stratify(by = "bbs_usgs", sample_data = TRUE)

# Stratify by Bird Conservation Regions only
data_strat <- stratify(by = "bcr", sample_data = TRUE)

# Stratify by CWS BBS stratifications
data_strat <- stratify(by = "bbs_cws", sample_data = TRUE)

# Stratify by State/Province/Territory only
data_strat <- stratify(by = "state", sample_data = TRUE)

# Stratify by blocks of 1 degree of latitude X 1 degree of longitude
data_strat <- stratify(by = "latlong", sample_data = TRUE)

# To stratify the entire dataset, simply set the sample_data = FALSE,
# or drop that argument altogher. The function then requires fetch_bbs_data()
# to have been run (takes about 10 minutes). Stratification of the entire dataset
# may take up to 3 minutes.


BrandonEdwards/bbsBayes documentation built on March 3, 2023, 9:55 a.m.