
Extract Features from Functional Intervals
extract_interval_features.RdUses one or more time intervals to compute subject-level summaries from a long-format weather series. This is useful after interval-wise testing has identified periods of functional divergence.
Usage
extract_interval_features(
data,
id_col,
time_col,
value_col,
intervals,
prefix = NULL,
statistics = "mean",
time_grid = NULL,
max_allowed_missing_pct = NULL
)Arguments
- data
A data frame in long format.
- id_col
Subject identifier column.
- time_col
Time column, such as relative day or days after planting.
- value_col
Measured series column.
- intervals
A data frame with
startandendcolumns.- prefix
Prefix used when naming the resulting features.
- statistics
Interval statistics to compute. Use function names such as
"mean","sd", and"IQR", or a named list of custom functions.- time_grid
Expected numeric measurement times on the original scale. If
NULL, uses the union of observed times across subjects. Supply the expected grid to count times missing for every subject. Use measurement times, rather than the denser grid used to plot smoothed curves.- max_allowed_missing_pct
Maximum missing percentage (0 to 100). Drop a predictor if any subject exceeds this limit.
NULLkeeps all predictors. Thecoveragetable keeps the diagnostics for dropped predictors.
Value
A list of two data frames with one row per subject. features
contains interval summaries. coverage contains recorded and expected
counts and missing percentages. An interval without any valid measurement
for a subject returns NA and 100 percent missing.
Details
Both interval endpoints are included. Feature names encode the
endpoints using the offset codes from make_windows(), such as
m02_z00 for an interval from -2 through 0. Subject-time pairs must be
unique and infinite measurements are rejected.