Passes through manually defined parameters, or defines them from metadata if present, and validates relevant data quality checks.
Usage
validate_numeric(
x,
elements = Inf,
range = NULL,
inclusive = c("left", "right"),
integer = FALSE,
msg1 = "",
msg2 = "."
)
validate_mnirs_data(data, ncol = 2L)
validate_nirs_channels(
nirs_channels,
data,
verbose = TRUE,
env = rlang::caller_env()
)
validate_time_channel(time_channel, data, env = rlang::caller_env())
validate_event_channel(
event_channel,
data,
required = TRUE,
env = rlang::caller_env()
)
estimate_sample_rate(x)
validate_sample_rate(data, time_channel, sample_rate, verbose = TRUE)
validate_width_span(width = NULL, span = NULL, verbose = TRUE)
validate_x_t(x, t = seq_along(x))Arguments
- x
A numeric vector.
- elements
A numeric value for the number of numeric elements in
arg.- range
A two-element numeric vector for the range of valid numeric values in
arg.- inclusive
A character vector to specify which of
leftand/orrightboundary values should be included in the range, or both (the default), or excluded ifFALSE.- integer
A logical indicating whether to test
argas an integer usingrlang::is_integerish(), rather than a numeric (FALSEby default).- msg1, msg2
A character string detailing the
cli_aborterror message returned for invalid numeric values passed toarg.- data
A data frame of class "mnirs" containing time series data and metadata.
- nirs_channels
A character vector of mNIRS channel names to operate on. Must match column names in
dataexactly. Retrieved from metadata if not defined explicitly.- verbose
A logical to display (the default) or silence (
FALSE) warnings and information messages used for troubleshooting.- time_channel
A character string indicating the time or sample channel name. Must match column names in
dataexactly. Retrieved from metadata if not defined explicitly.- event_channel
A character string indicating the event or lap channel name. Must match column names in
dataexactly. Retrieved from metadata if not defined explicitly.- required
A logical specifying whether
event_channelis required (the default) or optional (event_channelreturned asNULL).- sample_rate
A numeric value for the exported data sample rate in Hz. Retrieved from metadata or estimated from
time_channelif not defined explicitly.
Value
The validated object or an error message with cli::cli_abort().