Core Data Structures for Physiological Signal Analysis
PhysioCore provides the foundational S4 class system for the PhysioExperiment ecosystem. It defines the PhysioExperiment and PhysioEvents classes, extending Bioconductor's SummarizedExperiment to support multi-modal physiological signal data including EEG, EMG, ECG, IMU, and motion capture. With 45 exported functions, PhysioCore delivers lightweight but comprehensive infrastructure for channel management, event handling, array operations, and core signal accessors.
PhysioCore is now a compatibility package. The data model it used to implement -- the
PhysioExperimentclass and the containers for multiple streams, repeated sessions and cohorts -- lives in the PhysioExperiment package. This package re-exports that interface unchanged, solibrary(PhysioCore),PhysioCore::fn()andS4objects saved while the classes were defined here all keep working. New code should depend onPhysioExperimentdirectly.
You can install PhysioCore from r-universe:
# the containers build on Bioconductor, so its repositories are needed too
install.packages("BiocManager", repos = "https://cloud.r-project.org")
install.packages("PhysioCore",
repos = c("https://x-biosignal.r-universe.dev", BiocManager::repositories()))
Or install the development version from GitHub:
# install.packages("remotes", repos = "https://cloud.r-project.org")
remotes::install_github("x-biosignal/PhysioCore")
library(PhysioCore)
# Create a PhysioExperiment from a signal matrix (time x channels)
signal_matrix <- matrix(rnorm(1000 * 4), nrow = 1000, ncol = 4)
pe <- PhysioExperiment(
assays = list(raw = signal_matrix),
samplingRate = 250
)
# Access core properties
samplingRate(pe) # 250
nChannels(pe) # 4
duration(pe) # 4.0 (seconds)
timeIndex(pe) # time vector in seconds
# Channels are auto-named Ch1..Chn; assign montage labels and types, then select
channelNames(pe) <- c("Fz", "Cz", "Pz", "Oz")
pe <- setChannelTypes(pe, types = "eeg")
pe_subset <- pickChannels(pe, c("Fz", "Cz"))
channelInfo(pe)
# Add events (e.g., stimulus markers) and read them back
pe <- addEvents(pe, onset = c(0.5, 1.5, 2.5), duration = 0.1, type = "stimulus")
getEvents(pe)
nEvents(pe) # 3
# Summarize the object
summary(pe)
The PhysioExperiment class extends SummarizedExperiment with a samplingRate slot, supporting both 2D (time x channels) and 3D (time x channels x samples) assay layouts. The PhysioEvents class provides a structured container for experimental event markers with onset times, durations, and labels.
A full suite of functions for working with signal channels:
pickChannels(), dropChannels()
channelNames(), renameChannels()
setChannelTypes(), setChannelUnits(), channelInfo()
setElectrodePositions(), getElectrodePositions(), applyMontage()
Flexible event handling for experimental paradigms:
addEvents(), removeEvents()
getEvents(), eventQuery(), nEvents()
Essential property accessors for physiological signal objects:
samplingRate() / samplingRate<-() -- sampling frequency in Hzduration() -- recording duration in secondsnChannels() -- number of signal channelstimeIndex() -- time vector corresponding to sample indicesStandard R operations adapted for physiological signal semantics:
cbindPhysio() / rbindPhysio() -- combine experiments by channels or timeextractWindow() -- extract time windows by seconds or samples[ subsetting -- standard bracket subsetting with S4 dispatchRobust missing data management for real-world recordings:
checkNA() -- detect and report missing values per channelhandleNA() -- interpolation-based gap fillingreplaceNA() -- replace missing values with specified strategynaSummary() -- per-channel missing data summary statisticsStandard R generic methods with signal-aware implementations:
show(), summary() -- informative object displaydim(), length() -- dimension accessorsas.data.frame() -- conversion to long-format data framesPhysioCore is the foundation of the PhysioExperiment ecosystem, a suite of R packages for multi-modal physiological signal analysis:
| Package | Description |
|---|---|
| PhysioCore | Core data structures and accessors |
| PhysioIO | File I/O (EDF, HDF5, BIDS, CSV, MAT) |
| PhysioPreprocess | Preprocessing (filters, ICA, resampling) |
| PhysioAnalysis | Analysis and visualization |
Visit the r-universe page to browse all available packages.
MIT License. See LICENSE for details.
Yusuke Matsui
Part of the Physio ecosystem. Community and policy documents live in the umbrella repository: