Skip to contents

Widen the smoothing window of one sample for smooth_method = "grim" in smooth_community_data(). In each step, the window is widened by one sample at the lower end and then by one sample at the upper end, each only while the window stays within the sequence, spans less than smooth_age_range years, and has at most smooth_n_max samples.

Usage

util_search_parameter(
  A,
  B,
  smooth_age_range,
  smooth_n_max,
  smooth_n_points,
  dat_age,
  dat_community
)

Arguments

A

numeric. Index of the first sample of the starting window.

B

numeric. Index of the last sample of the starting window.

smooth_age_range

numeric. The age span of the window (difference between the ages of its first and last sample) must stay below this value.

smooth_n_max

numeric. Maximum number of samples in the window.

smooth_n_points

numeric. Number of samples of the starting window; the window is widened in smooth_n_max - smooth_n_points steps.

dat_age

data.frame with a column age, one row per sample.

dat_community

data.frame with one row per sample; only its number of rows is used.

Value

A numeric vector of length 2 with the indices of the first and the last sample of the window.

Details

The arguments are not checked here: the only caller, smooth_community_data(), checks them before it calls this helper for each sample.