Skip to contents

Processes a list of one or more dataframes of class "mnirs.data" representing distinct or ensembled kinetics events for further analysis.

Usage

prepare_kinetics_data(
  data,
  nirs_channels = NULL,
  time_channel = NULL,
  event_channel = NULL,
  event_times = NULL,
  event_labels = NULL,
  event_indices = NULL,
  group_events = list("distinct", "ensemble"),
  fit_span = c(30, 180),
  time_from_zero = TRUE,
  ...
)

Arguments

data

A dataframe of class "mnirs.data".

nirs_channels

A character vector indicating the mNIRS data channels to be processed from your dataframe. Must match data column names exactly. Will be taken from metadata if not defined explicitly.

time_channel

A character string indicating the time or sample data channel. Must match data column names exactly. Will be taken from metadata if not defined explicitly.

event_channel

An optional character string indicating an event or lap data channel. Must match data column names exactly. Will be taken from metadata if not defined explicitly.

event_times

An optional numeric vector corresponding to values of time_channel indicating the start of kinetic events. i.e., by time value or sample number.

event_labels

An optional character vector corresponding to values of event_channel indicating the start of kinetics events. i.e., by an event label such as "end work".

event_indices

An optional numeric vector indicating the starting row indices of kinetics events. i.e., to identify the start of kinetic events by row number.

group_events

Indicates how kinetics events should be analysed. Typically either "distinct" (the default) or "ensemble", but can be manually specified (see Details).

fit_span

A two-element numeric vector in the form c(before, after) in units of time_channel, defining the window around the kinetics events to include in the model fitting process (default fit_span = c(30, 180)).

time_from_zero

A logical. TRUE (the default) will resample time_channel to start from zero at the kinetic event. FALSE will return the original numeric values of time_channel. Grouping multiple events together will always resample to zero.

...

Additional arguments.

Value

A list of tibbles of class "mnirs.data" with metadata available with attributes().

Details

fit_span defines the widest extent of data before and after the kinetics event which may be included in the modelling process.

group_events indicates how kinetics events should be analysed, either separately, or grouped and ensemble averaged similar to oxygen uptake kinetics.

group_events = "distinct"

Will prepare a list of unique dataframes for each kinetics event (default).

group_events = "ensemble"

Will prepare one dataframe with the ensemble-averaged data from all mNIRS kinetics events.

group_events = list(c(1, 2), c(3, 4))

Will group kinetic events together in sequence of appearance, and prepare a list of ensemble-averaged dataframes for each group. Any kinetic events detected in the data but not explicitly defined here will return as a distinct dataframe.