Move the range of data channels in a dataframe up or down, while preserving the absolute dynamic range and/or relative scaling across channels. e.g. shift data range to positive values, or shift the first value of a recording to zero.
Arguments
- data
A dataframe.
- nirs_columns
A
list()
of character vectors indicating the column names for data channels to be shifted (see Details).- shift_to
A numeric scalar to which the specified data channels will be shifted to.
- position
Indicates how to shift values.
"minimum"
will shift selected channels' minimum values to the specified
shift_to
value (default)."maximum"
will shift selected channels by their maximum values.
"first"
will shift selected channels by their first values.
- mean_samples
An integer scalar representing the number of samples over which the
position
is determined. e.g.,mean_samples = 1
looks for the single minimum, maximum, or first value.mean_samples = 30
would use the mean of the lowest, highest, or first30
samples.- shift_by
An optional numeric scalar by which the data signals can be shifted by a set amount.
Value
A tibble of class mNIRS.data
with
metadata available with attributes()
.
Details
nirs_columns = list()
can be used to group data columns to preserve
absolute or relative scaling. channels grouped together in a vector
will preserve relative scaling across channels. Should match column names
in the dataframe exactly.
nirs_columns = list("A", "B", "C")
will shift each column separately. Absolute dynamic range for each data channel is preserved, but relative scaling will be lost between data channels.
nirs_columns = list(c("A", "B", "C"))
will shift all columns together. Absolute dynamic range and relative scaling are both preserved across the group of data channels.
nirs_columns = list(c("A", "B"), c("C", "D"))
will shift columns
A
andB
together, and columnsC
andD
together. Absolute dynamic range and relative scaling are preserved within each group, but not across groups of data channels.