View source: R/helper_functions.R
| pick_data | R Documentation |
Filters an input dataset by optional constraints on subject, sensor, time, and epoch.
Filters are combined with logical AND, and exact value matching (%in%) is used.
pick_data(
data,
subject_rg = NULL,
sensor_rg = NULL,
time_rg = NULL,
epoch_rg = NULL
)
data |
A data frame, tibble or database table with input data. Required columns depend on the further parameters: setting |
subject_rg |
Optional vector of subject identifiers to keep (character or numeric, matching |
sensor_rg |
Optional vector of sensor identifiers to keep (character or numeric, matching |
time_rg |
Optional vector of time points to keep (numeric, matching |
epoch_rg |
Optional vector of epoch identifiers to keep (character or numeric, matching |
All filters are combined conjunctively (AND). Matching uses membership (%in%) with case-sensitive comparison for character columns.
On database backends, very long *_rg vectors may not translate efficiently; consider pre-filtering or semi-joins.
An object of the same class as data with rows filtered by the provided criteria; columns are unchanged.
If all filters are NULL, the input is returned unmodified. If no rows match, the function ends with error message.
compute_mean, baseline_correction, pick_region
# Filtering epochs 1:5 and time points 1:10 for all subjects and sensor "E45"
data_subset <- pick_data(epochdata, sensor_rg = "E45",
time_rg = 1:10, epoch_rg = 1:5)
head(data_subset)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.