format_data_flat: Format data

Description Usage Arguments Details Value Author(s) Examples

View source: R/format_data.R

Description

Format data

Usage

1
2
3
4
format_data_flat(data, strata = "Transect", year = NULL, strata.area = 1,
  sample = "Point", visitnum = "Visit", weights = NULL, species = "Spp",
  count = "Count", dist = NULL, dist_bin_id = "Distance.Bin.ID",
  flyover = NULL, protocol = "Protocol")

Arguments

data

Original point count dataframe with individual species detections and distances in each row; ok to contain multiple species at this stage

strata

Column name in data specifying the groups for which you want density estimates (e.g., site, vegetation age class, or a combination of the two); defaults to "Transect"; it's ok to have only 1 stratum

year

Optional, defaults to NULL; if density estimates should be generated by year and strata, change to column name in data indicating year

strata.area

Default of 1 produces estimates of the number of individuals per hectare; change to name of column representing actual area of each stratum (in hectares) to instead extrapolate densities and estimate total number of individuals

sample

Column name in data specifying independent sampling locations within each stratum; defaults to "Point"

visitnum

Column name in data defining the unique visit (survey) number or ID at each sampling location within each stratum; used to calculate sampling effort at each location; defaults to "Visit"

weights

Optional, defaults to NULL; Column name in data to multiply sampling effort by (e.g., percent cover of target vegetation type)

species

Column name in data containing name or code of species detected; defaults to "Spp"

count

Column name in data containing the number of individuals for each detection; defaults to "Count"

dist

Column name in data containing estimated distance to each species detection (in meters); defaults to NULL

dist_bin_id

Defaults to 'Distance.Bin.ID'; currently only partially supported for protocol VCP25

flyover

Optional, defaults to NULL; Column name in data flagging flyover detections for removal

protocol

Column name in data containing point count protocol ID; defaults to "Protocol"; drops fixed radius protocol FR50 and produces warning if data contains more than one other protocol

Details

This function is the first step in conducting a distance analysis, formatting point count data into the data structure with column names required by the package Distance.

Default values are intended for work with California Avian Data Center (CADC) outputs, using column names produced by downloading data in "Project Lead" mode, but should be adaptable to other formats.

Effort is calculated as the number of unique values in visitnum for each strata and optionally year. Effort may be further weighted by values in weights. For error checking, the function will print the total number of unique strata and sampling locations identified, as well as the range of the number of visits to each sampling location.

The function requires providing either dist, a numeric column with detection distances (which may represent the midpoint of distance bins), or dist_bin_id. If only dist_bin_id is provided, the function will attempt to translate the standard bin IDs provided by CADC to the corresponding numeric midpoint values for the protocol VCP25 only. For all other protocols, the function currently produces an error. All distances are assumed to be in meters and strata area in hectares.

Any values in flyover other than ”, ' ', or NA are assumed to flag birds flying over a sampling location (but not using the sampling location), and will be removed.

Value

Returns a data frame including columns required by package Distance, including: Region.Label, Area, Sample.Label, Effort, and distance. Also returns species, count, protocol, and any other unused columns remaining in original data.

Author(s)

Kristen Dybala, kdybala@pointblue.org

Examples

1
## Not run: fdat = format.data(data=dat, strata='group')

kdybala/pbdistance documentation built on May 20, 2019, 8:28 a.m.