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,
  event_sample = NULL,
  event_label = NULL,
  event_index = NULL,
  fit_window = c(30, 180),
  display_window = NULL,
  group_events = list("distinct", "ensemble"),
  nirs_columns = NULL,
  sample_column = NULL,
  event_column = NULL,
  sample_rate = NULL,
  ...
)

Arguments

data

A dataframe of class "mNIRS.data".

event_sample

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

event_label

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

event_index

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

fit_window

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

display_window

(Not currently implemented) An optional two-element numeric vector in the form c(before, after) in units of sample_column, defining the window around the kinetics events to include for display, but not for model fitting.

group_events

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

nirs_columns

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

sample_column

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

event_column

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

sample_rate

A numeric scalar for the sample rate in Hz. Will be taken from metadata if not defined explicitly.

...

Additional arguments.

Value

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

Details

display_window defines the widest range of data before and after the kinetics event which will be passed on in the dataframe, but not included in the modelling process. fit_window 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.