attempt_limits: Determine start and end dates of nesting attempt

View source: R/revisit_funs.R

attempt_limitsR Documentation

Determine start and end dates of nesting attempt

Description

attempt_limits Determines the start and end dates of the potential nesting attempt based on the patterns of revisitation of the candidate nest.

Usage

attempt_limits(x, min_consec, nest_cycle)

Arguments

x

data.frame of daily revisitation history of a candidate nest

min_consec

Integer. Minimum number of consecutive days a location needs to be visited to be considered as a candidate nest. See Details

nest_cycle

Integer. Duration (in days) of a complete nesting cycle

Details

Used with lapply inside function revisit_stats.

The function uses a moving window of size nest_cycle to find the most likely time range of the nesting attempt.

Attendance is expected to be maximum during the initial phase of nesting, so we assume that the longest series of consecutive days corresponds to the beginnig of the nesting attempt. Therefore, the moving window starts at the beginning of the first series of consecutive days longer than min_consec. This helps discard any early visits to the nest before the actual start of the attempt.

After that, the function slides a moving window of size nest_cycle to the data until it hits the last visit. The window that encompasses the highest number of visits is selected as most likely delimiting the nesting attempt.

If the last nest visit is on the end date of the window or later, the end of the attempt is set at the end date of the window (which is the start date + nest_cycle). This helps discard any later visits to the nest after the attempt is already concluded.

If the last nest visit is earlier than the ending date of the window, the end of the attempt is set at the date of the last visit.

Value

Returns data.frame with start and end dates of the attempt and number of nest visits within it.


picardis/nestR documentation built on July 2, 2024, 6:35 p.m.