Skip to contents

Summarize AirDAS effort data by effort segment, while averaging conditions

Usage

airdas_segdata(x, ...)

# S3 method for data.frame
airdas_segdata(x, ...)

# S3 method for airdas_df
airdas_segdata(
  x,
  conditions,
  segdata.method = c("avg", "maxdist"),
  seg.lengths,
  section.id,
  ...
)

Arguments

x

airdas_df object, or a data frame that can be coerced to a airdas_df object. Must contain a single continuous effort section of AirDAS data; see the Details section below

...

ignored

conditions

see airdas_effort, or see Details section for more information

segdata.method

character; either "avg" or "maxdist". "avg" means the condition values will be calculated as a weighted average by distance, while "maxdist" means the condition values will be those recorded for the longest distance during that segment

seg.lengths

numeric; length of the modeling segments into which x will be chopped

section.id

numeric; the ID of x (the current continuous effort section)

Value

Data frame with the segdata information described above and in airdas_effort

Details

WARNING - do not call this function directly! It is exported for documentation purposes, but is intended for internal package use only.

This function was designed to be called by one of the airdas_chop_ functions, e.g. airdas_chop_equallength, and thus users should avoid calling it themselves. It loops through the events in x, calculating and storing relevant information for each modeling segment as it goes. Because x is a continuous effort section, it must begin with a "T" or "R" event and end with the corresponding "E" or "O" event.

For each segment, this function reports the segment ID, transect code, the start/end/mid coordinates (lat/lon), start/end/mid date/times (DateTime), segment length, year, month, day, time, observers, and average conditions (which are specified by conditions). The segment ID is designated as section.id _ index of the modeling segment. Thus, if section.id is 1, then the segment ID for the second segment from x is "1_2".

When segdata.method is "avg", the condition values are calculated as a weighted average by distance. The reported value for logical columns (e.g. Haze) is the percentage (in decimals) of the segment in which that condition was TRUE. For character columns, the reported value for each segment is the unique value(s) present in the segment, with NAs omitted, pasted together via paste(..., collapse = "; "). When segdata.method is "maxdist", the reported values are, for each condition, the value recorded for the longest distance during that segment (with NAs omitted).

Transect code, file name, and vent code that started the continuous effort section are also included in the segdata output. These values (excluding NAs) must be consistent across the entire effort section, and thus across all segments in x; a warning is printed if there are any inconsistencies.

bearing and destination are used to calculate the segment start, mid, and end points, with method = "vincenty".