Filter or Label Data Based on Sampling Rate Threshold

Description

This function applies a sampling rate threshold and either removes or labels "bad" subjects/trials based on their sampling rates.

Usage

filter_sampling_rate(
  data,
  threshold = NA,
  action = c("remove", "label"),
  by = c("subject", "trial", "both")
)

Arguments

data A dataframe with columns: subject, trial, SR_subject, SR_trial.
threshold Numeric. Sampling rate threshold to apply.
action "remove" (default) to delete bad data or "label" to flag bad data.
by "subject", "trial", or "both" to specify where to apply the threshold.

Value

A dataframe with either rows removed or bad subjects/trials labeled.