Summarize DAS effort data by effort segment, while averaging or getting the max for each condition
das_segdata(x, ...)# S3 method for data.frame
das_segdata(x, ...)
# S3 method for das_df
das_segdata(
x,
conditions,
segdata.method = c("avg", "maxdist"),
seg.lengths,
section.id,
...
)
an object of class das_df
,
or a data frame that can be coerced to class das_df
Must contain a single continuous effort section of DAS data;
see the Details section below
ignored
see das_effort
, or
see Details section for more information
character; either avg" or "maxdist". See Details section for more information
numeric; length of the modeling segments
into which x
will be chopped
numeric; the ID of x
(the current continuous effort section)
Data frame with the segdata information described in Details
and in das_effort
This function was designed to be called by one of the das_chop_ functions,
e.g. das_chop_equallength
, and thus
users should avoid calling it themselves.
It loops through the events in x
, chopping x
into modeling segments
while calculating and storing relevant information for each segment.
Because x
is a continuous effort section, it must begin with
a "B" or "R" event and end with the corresponding "E" event.
For each segment, this function reports the segment number,
segment ID, cruise number, the start/end/midpoints (lat/lon), segment length,
year, month, day, time, mode, effort type,
effective strip width sides (number of sides searched),
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. Glare) 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 NA
s 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 NA
s omitted).
Cruise number, mode, effort type, sides searched, and file name are
also included in the segdata output.
These values (excluding NA
s) 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"
.