Applies scan_windows() to many site-specific reference dates and returns a
wide table with one row per reference event and one column per metric-window
combination. The reference date can be an assessment date, planting date, or
any other timestamp stored in the input table.
Usage
window_pane(
weather,
assessments,
windows,
reference_col = NULL,
id_col = NULL,
response_col = NULL,
weather_cols,
time_col = "time",
unit = c("days", "hours"),
statistics,
site_col = id_col,
sampling_interval = NULL,
max_allowed_missing_pct = NULL
)Arguments
- weather
A weather data frame.
- assessments
A data frame containing reference times and optional IDs or responses.
- windows
A data frame created by
make_windows()ordefine_windows().- reference_col
Name of the reference timestamp column. If
NULL, the function uses metadata stored bymake_windows()or falls back to"assessment_time".- id_col
Optional identifier column from
assessmentsto retain. By default it also serves as the site key.- response_col
Optional response column, such as disease intensity.
- weather_cols
Required character vector of existing numeric weather columns. Column names must be unique, non-missing, and non-empty. If named, every entry must have a unique, non-missing, non-empty output alias;
.conditionsis reserved. No columns are inferred. Usecharacter()explicitly for condition-only summaries.- time_col
Name of the weather timestamp column.
- unit
Time unit for relative-time windows. One of
"days"or"hours".- statistics
Required summary specification. Use a non-empty character vector to apply the same statistics to all
weather_cols, such asc("mean", "sd", "IQR"). Alternatively, use a named list keyed by every selected column's output alias (or column name when unnamed), with no unknown keys. Each entry must be a non-empty character vector or a nested named list of functions or single function names, for examplelist(temp = list(avg = "mean", spread = stats::sd)). Statistic names must be unique, non-missing, and non-empty. No summaries are inferred. The optional.conditionsentry is a named list of multivariable condition summaries such ascount_when(temp >= 18 & rh >= 90).- site_col
Column used to match sites in both tables. Defaults to
id_col. Set explicitly toNULLfor one shared weather series, even when retaining an assessment identifier withid_col. A site key must contain no missing or blank values and every assessment site must have weather.- sampling_interval
Expected spacing between measurements, in
unit. IfNULL, uses the shortest gap between recorded timestamps within the series, or one unit if fewer than two timestamps are available. Supply the spacing when gaps may hide the actual sampling frequency.- max_allowed_missing_pct
Optional maximum missing percentage (0 to 100). Drop a predictor column if any assessment exceeds the limit. Its diagnostics remain in
coverage.NULLkeeps all predictor columns.
