View source: R/aanalyse_kinetics_helpers.R
| analyse_kinetics_channels | R Documentation |
Shared per-channel skeleton for all analyse_kinetics() methods. For
each channel, resolves the fitting window via find_kinetics_idx(),
delegates the method-specific fit to fit_fn, and, for methods listed
in kinetics_fallbacks, tests the fit with the method's trigger. A
channel with a reason is refit by the reduced method (recursively down
the chain) with the arguments it takes, the spec's overrides, and the
user-fixed parameters it shares; the fallback is warned about and so
recorded in the warnings attribute. A row where every fit in the
chain failed reports the last method tried with NA coefficients.
analyse_kinetics_channels(
data,
nirs_channels,
time_channel,
per_channel,
fit_fn,
verbose = TRUE,
interval_name = NA_character_,
extra_args = list(),
method = NULL,
fallback = TRUE,
env = rlang::caller_env()
)
data |
A single "mnirs" data frame. |
nirs_channels |
Character vector of resolved channel names. |
time_channel |
Character; resolved time column name. |
per_channel |
Named list (one element per channel) of resolved and
validated argument lists from |
fit_fn |
A channel fitter |
verbose |
Logical. |
interval_name |
Character; the interval name recorded in the |
extra_args |
Named list of additional arguments recorded in the
|
method |
Character; the canonical method name keying
|
fallback |
Logical; resolve the fallback chain. |
env |
The calling environment or a defused call, used to report errors and warnings as coming from the user-facing function rather than the validator. |
Methods with a fallback report the fitting method per row in a model
coefficient column and the union of the chain's coefficient columns
(NA where a model has no such parameter), so intervals bind
regardless of which triggers fire. build_kinetics_results() then
drops the columns of fallback models no row resolved to.
A data.frame of coefficients (columns interval,
nirs_channels, model for chained methods, and method parameters),
one row per channel, with attributes "time_channel" (the resolved
time column name), "model" and "fitted_data" (named lists by
channel), "diagnostics" and "channel_args" (data frames, one row
per channel), and "warnings" (data frame of conditions captured
during fitting, regardless of verbose; zero rows when none fire).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.