| Title: | Core Data Structures for Physiological Signal Analysis |
|---|---|
| Description: | Provides the PhysioExperiment class, a SummarizedExperiment extension for multi-modal physiological signal data. Includes core accessors, channel and event management, and basic S4 methods. Designed as a lightweight foundation for the Physio ecosystem. |
| Authors: | Yusuke Matsui |
| Maintainer: | Yusuke Matsui <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.2.0 |
| Built: | 2026-05-16 05:24:58 UTC |
| Source: | https://github.com/x-biosignal/PhysioCore |
Silently registers the package namespace. This file is a placeholder for future registration routines (e.g. S3 methods or database initialisation).
.onLoad(libname, pkg).onLoad(libname, pkg)
libname |
Library path. |
pkg |
Package name. |
Extracts a subset of the PhysioExperiment by row (time) and/or
column (channel) indices, preserving all metadata.
## S4 method for signature 'PhysioExperiment,ANY,ANY,ANY' x[i, j, ..., drop = FALSE]## S4 method for signature 'PhysioExperiment,ANY,ANY,ANY' x[i, j, ..., drop = FALSE]
x |
A PhysioExperiment object. |
i |
Time indices (rows). |
j |
Channel indices (columns in first non-time dimension). |
... |
Additional arguments (not used). |
drop |
Logical. If TRUE, drops dimensions of size 1. |
A PhysioExperiment object containing only the selected
time points and/or channels, with updated rowData and colData.
Huber, W., et al. (2015). "Orchestrating high-throughput genomic analysis with Bioconductor." Nature Methods, 12(2), 115-121. doi:10.1038/nmeth.3252
Morgan, M., et al. (2022). "S4Vectors: Foundation of vector-like and list-like containers in Bioconductor." R package.
extractWindow for subsetting by time in seconds,
pickChannels for subsetting by channel name,
dropChannels for removing specific channels
pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), samplingRate = 100 ) # Subset by time pe_subset <- pe[1:50, ] dim(pe_subset) # 50 4 # Subset by channels pe_channels <- pe[, 1:2] dim(pe_channels) # 100 2pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), samplingRate = 100 ) # Subset by time pe_subset <- pe[1:50, ] dim(pe_subset) # 50 4 # Subset by channels pe_channels <- pe[, 1:2] dim(pe_channels) # 100 2
Add events to a PhysioExperiment object
addEvents(x, onset, duration = 0, type = "event", value = "")addEvents(x, onset, duration = 0, type = "event", value = "")
x |
A PhysioExperiment object. |
onset |
Numeric vector of event onset times in seconds. |
duration |
Numeric vector of event durations in seconds. |
type |
Character vector of event types. |
value |
Character vector of event values/labels. |
The modified PhysioExperiment object.
Delorme A, Makeig S (2004). "EEGLAB: an open source toolbox for analysis of single-trial EEG dynamics." Journal of Neuroscience Methods, 134(1), 9-21.
Oostenveld R, Fries P, Maris E, Schoffelen JM (2011). "FieldTrip: Open source software for advanced analysis of MEG, EEG, and invasive electrophysiological data." Computational Intelligence and Neuroscience, 2011, 156869.
setEvents for replacing all events,
removeEvents for removing events,
getEvents for retrieving events,
nEvents for event count
pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(1000), nrow = 100)), samplingRate = 100 ) # Add stimulus events pe <- addEvents(pe, onset = c(1, 2, 3), type = "stimulus") # Add response events pe <- addEvents(pe, onset = c(1.5, 2.5), type = "response", value = c("hit", "hit")) nEvents(pe) # 5 events totalpe <- PhysioExperiment( assays = list(raw = matrix(rnorm(1000), nrow = 100)), samplingRate = 100 ) # Add stimulus events pe <- addEvents(pe, onset = c(1, 2, 3), type = "stimulus") # Add response events pe <- addEvents(pe, onset = c(1.5, 2.5), type = "response", value = c("hit", "hit")) nEvents(pe) # 5 events total
Applies a standard electrode montage (e.g., 10-20 system).
applyMontage(x, system = c("10-20", "10-10", "10-5"))applyMontage(x, system = c("10-20", "10-10", "10-5"))
x |
A PhysioExperiment object. |
system |
Montage system: "10-20", "10-10", or "10-5". |
Modified PhysioExperiment object with electrode positions.
Oostenveld R, Fries P, Maris E, Schoffelen JM (2011). "FieldTrip: Open source software for advanced analysis of MEG, EEG, and invasive electrophysiological data." Computational Intelligence and Neuroscience, 2011, 156869.
setElectrodePositions for custom positions,
getElectrodePositions for reading positions,
channelNames for channel labels,
setReference for reference electrode
pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), colData = S4Vectors::DataFrame(label = c("Fz", "Cz", "Pz", "Oz")), samplingRate = 100 ) # Apply 10-20 system positions pe <- applyMontage(pe, "10-20") getElectrodePositions(pe)pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), colData = S4Vectors::DataFrame(label = c("Fz", "Cz", "Pz", "Oz")), samplingRate = 100 ) # Apply 10-20 system positions pe <- applyMontage(pe, "10-20") getElectrodePositions(pe)
Converts the default assay of a PhysioExperiment to a
data.frame with a time column (in seconds) followed by
one column per channel.
## S4 method for signature 'PhysioExperiment' as.data.frame(x, row.names = NULL, optional = FALSE, ...)## S4 method for signature 'PhysioExperiment' as.data.frame(x, row.names = NULL, optional = FALSE, ...)
x |
A PhysioExperiment object. |
row.names |
Unused. |
optional |
Unused. |
... |
Additional arguments. |
A data.frame with a time column and one column per
channel. For 3D arrays, only the first sample (third dimension index 1)
is returned. Returns an empty data.frame if no assays are present.
Huber, W., et al. (2015). "Orchestrating high-throughput genomic analysis with Bioconductor." Nature Methods, 12(2), 115-121. doi:10.1038/nmeth.3252
Morgan, M., et al. (2022). "S4Vectors: Foundation of vector-like and list-like containers in Bioconductor." R package.
summary,PhysioExperiment-method for summary statistics,
timeIndex for the time vector,
channelNames for column names
pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(12), nrow = 3, ncol = 4)), colData = S4Vectors::DataFrame(label = c("Fz", "Cz", "Pz", "Oz")), samplingRate = 100 ) df <- as.data.frame(pe) head(df)pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(12), nrow = 3, ncol = 4)), colData = S4Vectors::DataFrame(label = c("Fz", "Cz", "Pz", "Oz")), samplingRate = 100 ) df <- as.data.frame(pe) head(df)
Combines two PhysioExperiment objects by concatenating along the channel (column) dimension. Both objects must have the same number of time points and matching sampling rates.
cbindPhysio(x, y)cbindPhysio(x, y)
x |
A PhysioExperiment object. |
y |
A PhysioExperiment object to combine. |
A PhysioExperiment object with channels from both x
and y, combined colData, and metadata from x.
Huber, W., et al. (2015). "Orchestrating high-throughput genomic analysis with Bioconductor." Nature Methods, 12(2), 115-121. doi:10.1038/nmeth.3252
Morgan, M., et al. (2022). "S4Vectors: Foundation of vector-like and list-like containers in Bioconductor." R package.
rbindPhysio for combining along the time axis,
pickChannels for selecting specific channels,
dropChannels for removing channels
pe1 <- PhysioExperiment( assays = list(raw = matrix(rnorm(200), nrow = 100, ncol = 2)), colData = S4Vectors::DataFrame(label = c("Fz", "Cz")), samplingRate = 100 ) pe2 <- PhysioExperiment( assays = list(raw = matrix(rnorm(200), nrow = 100, ncol = 2)), colData = S4Vectors::DataFrame(label = c("Pz", "Oz")), samplingRate = 100 ) # Combine channels pe_combined <- cbindPhysio(pe1, pe2) nChannels(pe_combined) # 4pe1 <- PhysioExperiment( assays = list(raw = matrix(rnorm(200), nrow = 100, ncol = 2)), colData = S4Vectors::DataFrame(label = c("Fz", "Cz")), samplingRate = 100 ) pe2 <- PhysioExperiment( assays = list(raw = matrix(rnorm(200), nrow = 100, ncol = 2)), colData = S4Vectors::DataFrame(label = c("Pz", "Oz")), samplingRate = 100 ) # Combine channels pe_combined <- cbindPhysio(pe1, pe2) nChannels(pe_combined) # 4
Functions for managing channel metadata including labels, types, units, and electrode positions. Get channel information
channelInfo(x)channelInfo(x)
x |
A PhysioExperiment object. |
Returns channel metadata as a DataFrame. Channel information is stored in colData (columns = channels).
A DataFrame with channel information.
Oostenveld R, Fries P, Maris E, Schoffelen JM (2011). "FieldTrip: Open source software for advanced analysis of MEG, EEG, and invasive electrophysiological data." Computational Intelligence and Neuroscience, 2011, 156869.
channelNames for channel labels,
nChannels for channel count,
setChannelTypes for assigning channel types
pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), colData = S4Vectors::DataFrame( label = c("Fz", "Cz", "Pz", "Oz"), type = rep("EEG", 4) ), samplingRate = 100 ) # Get channel information channelInfo(pe) # Get channel names channelNames(pe) # Get number of channels nChannels(pe)pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), colData = S4Vectors::DataFrame( label = c("Fz", "Cz", "Pz", "Oz"), type = rep("EEG", 4) ), samplingRate = 100 ) # Get channel information channelInfo(pe) # Get channel names channelNames(pe) # Get number of channels nChannels(pe)
Updates channel metadata. Channel information is stored in colData (columns = channels).
channelInfo(x) <- valuechannelInfo(x) <- value
x |
A PhysioExperiment object. |
value |
A DataFrame with channel information. |
Modified PhysioExperiment object.
Oostenveld R, Fries P, Maris E, Schoffelen JM (2011). "FieldTrip: Open source software for advanced analysis of MEG, EEG, and invasive electrophysiological data." Computational Intelligence and Neuroscience, 2011, 156869.
channelInfo for reading channel metadata,
channelNames for channel labels,
setChannelTypes for assigning channel types
pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), samplingRate = 100 ) # Set channel info channelInfo(pe) <- S4Vectors::DataFrame( label = c("Fz", "Cz", "Pz", "Oz"), type = rep("EEG", 4) )pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), samplingRate = 100 ) # Set channel info channelInfo(pe) <- S4Vectors::DataFrame( label = c("Fz", "Cz", "Pz", "Oz"), type = rep("EEG", 4) )
Get channel names/labels
channelNames(x)channelNames(x)
x |
A PhysioExperiment object. |
Character vector of channel names.
Oostenveld R, Fries P, Maris E, Schoffelen JM (2011). "FieldTrip: Open source software for advanced analysis of MEG, EEG, and invasive electrophysiological data." Computational Intelligence and Neuroscience, 2011, 156869.
channelInfo for full channel metadata,
renameChannels for renaming channels,
nChannels for channel count
pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), colData = S4Vectors::DataFrame(label = c("Fz", "Cz", "Pz", "Oz")), samplingRate = 100 ) channelNames(pe) # c("Fz", "Cz", "Pz", "Oz")pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), colData = S4Vectors::DataFrame(label = c("Fz", "Cz", "Pz", "Oz")), samplingRate = 100 ) channelNames(pe) # c("Fz", "Cz", "Pz", "Oz")
Set channel names/labels
channelNames(x) <- valuechannelNames(x) <- value
x |
A PhysioExperiment object. |
value |
Character vector of channel names. |
Modified PhysioExperiment object.
Oostenveld R, Fries P, Maris E, Schoffelen JM (2011). "FieldTrip: Open source software for advanced analysis of MEG, EEG, and invasive electrophysiological data." Computational Intelligence and Neuroscience, 2011, 156869.
channelNames for reading channel labels,
renameChannels for renaming specific channels,
channelInfo for full channel metadata
pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), samplingRate = 100 ) channelNames(pe) <- c("Fz", "Cz", "Pz", "Oz") channelNames(pe)pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), samplingRate = 100 ) channelNames(pe) <- c("Fz", "Cz", "Pz", "Oz") channelNames(pe)
Validates assay data for NA values and reports statistics.
checkNA(x, action = c("warn", "error", "none"))checkNA(x, action = c("warn", "error", "none"))
x |
A PhysioExperiment object or numeric array. |
action |
Action to take: "warn" (default), "error", or "none". |
Invisibly returns a list with NA statistics.
Oostenveld R, Fries P, Maris E, Schoffelen JM (2011). "FieldTrip: Open source software for advanced analysis of MEG, EEG, and invasive electrophysiological data." Computational Intelligence and Neuroscience, 2011, 156869.
hasNA for quick NA presence check,
naSummary for per-assay NA statistics,
handleNA for NA replacement strategies
pe <- PhysioExperiment( assays = list(raw = matrix(c(1, NA, 3, 4), nrow = 2)), samplingRate = 100 ) checkNA(pe)pe <- PhysioExperiment( assays = list(raw = matrix(c(1, NA, 3, 4), nrow = 2)), samplingRate = 100 ) checkNA(pe)
Returns the name of the first assay in the PhysioExperiment object,
which is treated as the default assay for operations that do not specify
an assay explicitly.
defaultAssay(x)defaultAssay(x)
x |
A |
Character scalar naming the first assay, or NA_character_
when no assays are present.
Huber, W., et al. (2015). "Orchestrating high-throughput genomic analysis with Bioconductor." Nature Methods, 12(2), 115-121. doi:10.1038/nmeth.3252
Morgan, M., et al. (2022). "S4Vectors: Foundation of vector-like and list-like containers in Bioconductor." R package.
PhysioExperiment for the constructor,
samplingRate for the sampling rate accessor,
timeIndex for time point vector
Returns the dimensions of the default assay.
## S4 method for signature 'PhysioExperiment' dim(x)## S4 method for signature 'PhysioExperiment' dim(x)
x |
A PhysioExperiment object. |
An integer vector of dimensions (time points x channels x samples),
or NULL if no assays are present.
Huber, W., et al. (2015). "Orchestrating high-throughput genomic analysis with Bioconductor." Nature Methods, 12(2), 115-121. doi:10.1038/nmeth.3252
Morgan, M., et al. (2022). "S4Vectors: Foundation of vector-like and list-like containers in Bioconductor." R package.
length,PhysioExperiment-method for time point count,
nChannels for channel count,
defaultAssay for the assay being queried
pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), samplingRate = 100 ) dim(pe) # 100 4pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), samplingRate = 100 ) dim(pe) # 100 4
Creates a new PhysioExperiment without specified channels.
dropChannels(x, channels)dropChannels(x, channels)
x |
A PhysioExperiment object. |
channels |
Integer indices or character names of channels to drop. |
A new PhysioExperiment without specified channels.
Oostenveld R, Fries P, Maris E, Schoffelen JM (2011). "FieldTrip: Open source software for advanced analysis of MEG, EEG, and invasive electrophysiological data." Computational Intelligence and Neuroscience, 2011, 156869.
pickChannels for keeping specific channels,
getChannelsByType for finding channels by type,
nChannels for channel count
pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), colData = S4Vectors::DataFrame(label = c("Fz", "Cz", "Pz", "Oz")), samplingRate = 100 ) # Drop by index pe_dropped <- dropChannels(pe, 1) nChannels(pe_dropped) # 3 # Drop by name pe_dropped <- dropChannels(pe, c("Fz", "Oz"))pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), colData = S4Vectors::DataFrame(label = c("Fz", "Cz", "Pz", "Oz")), samplingRate = 100 ) # Drop by index pe_dropped <- dropChannels(pe, 1) nChannels(pe_dropped) # 3 # Drop by name pe_dropped <- dropChannels(pe, c("Fz", "Oz"))
Computes the total duration of the signal in seconds from the number of time points and the sampling rate.
duration(x)duration(x)
x |
A PhysioExperiment object. |
Numeric scalar giving the signal duration in seconds, or
NA_real_ if the sampling rate is not set.
Huber, W., et al. (2015). "Orchestrating high-throughput genomic analysis with Bioconductor." Nature Methods, 12(2), 115-121. doi:10.1038/nmeth.3252
Morgan, M., et al. (2022). "S4Vectors: Foundation of vector-like and list-like containers in Bioconductor." R package.
samplingRate for the sampling rate,
length,PhysioExperiment-method for time point count,
timeIndex for the time vector,
extractWindow for time-based subsetting
pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(1000), nrow = 1000, ncol = 4)), samplingRate = 100 ) duration(pe) # 10 secondspe <- PhysioExperiment( assays = list(raw = matrix(rnorm(1000), nrow = 1000, ncol = 4)), samplingRate = 100 ) duration(pe) # 10 seconds
Extracts a time window from the signal based on start and end times in seconds.
extractWindow(x, tmin, tmax)extractWindow(x, tmin, tmax)
x |
A PhysioExperiment object. |
tmin |
Start time in seconds. |
tmax |
End time in seconds. |
A PhysioExperiment object containing only the samples
within the specified time window, with preserved channel and event
metadata.
Huber, W., et al. (2015). "Orchestrating high-throughput genomic analysis with Bioconductor." Nature Methods, 12(2), 115-121. doi:10.1038/nmeth.3252
Morgan, M., et al. (2022). "S4Vectors: Foundation of vector-like and list-like containers in Bioconductor." R package.
duration for total signal duration,
timeIndex for the time vector,
[ for index-based subsetting,
timeToSamples for converting times to indices
pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(1000), nrow = 1000, ncol = 4)), samplingRate = 100 ) # Extract 2 to 5 seconds pe_window <- extractWindow(pe, tmin = 2, tmax = 5) duration(pe_window) # approximately 3 secondspe <- PhysioExperiment( assays = list(raw = matrix(rnorm(1000), nrow = 1000, ncol = 4)), samplingRate = 100 ) # Extract 2 to 5 seconds pe_window <- extractWindow(pe, tmin = 2, tmax = 5) duration(pe_window) # approximately 3 seconds
Fills NA values at the beginning and end of a signal that may result from filtering operations.
fillEdgeNA(x, method = c("extend", "zero"))fillEdgeNA(x, method = c("extend", "zero"))
x |
Numeric vector. |
method |
Fill method: "extend" (extend nearest valid value) or "zero" (fill with zeros). |
Vector with edge NA values filled.
Oostenveld R, Fries P, Maris E, Schoffelen JM (2011). "FieldTrip: Open source software for advanced analysis of MEG, EEG, and invasive electrophysiological data." Computational Intelligence and Neuroscience, 2011, 156869.
handleNA for general NA handling strategies,
replaceNA for NA handling in PhysioExperiment assays
x <- c(NA, NA, 1, 2, 3, NA, NA) fillEdgeNA(x, method = "extend")x <- c(NA, NA, 1, 2, 3, NA, NA) fillEdgeNA(x, method = "extend")
Returns indices of channels matching specified types.
getChannelsByType(x, types)getChannelsByType(x, types)
x |
A PhysioExperiment object. |
types |
Character vector of channel types to match. |
Integer vector of matching channel indices.
Oostenveld R, Fries P, Maris E, Schoffelen JM (2011). "FieldTrip: Open source software for advanced analysis of MEG, EEG, and invasive electrophysiological data." Computational Intelligence and Neuroscience, 2011, 156869.
setChannelTypes for assigning channel types,
pickChannels for subsetting by channel,
dropChannels for removing channels
pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), colData = S4Vectors::DataFrame( label = c("Fz", "EOG1", "EMG1", "Oz"), type = c("EEG", "EOG", "EMG", "EEG") ), samplingRate = 100 ) # Get EEG channels eeg_idx <- getChannelsByType(pe, "EEG") # c(1, 4)pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), colData = S4Vectors::DataFrame( label = c("Fz", "EOG1", "EMG1", "Oz"), type = c("EEG", "EOG", "EMG", "EEG") ), samplingRate = 100 ) # Get EEG channels eeg_idx <- getChannelsByType(pe, "EEG") # c(1, 4)
Get electrode positions
getElectrodePositions(x)getElectrodePositions(x)
x |
A PhysioExperiment object. |
A data.frame with x, y, z columns or NULL if not set.
Oostenveld R, Fries P, Maris E, Schoffelen JM (2011). "FieldTrip: Open source software for advanced analysis of MEG, EEG, and invasive electrophysiological data." Computational Intelligence and Neuroscience, 2011, 156869.
setElectrodePositions for setting positions,
applyMontage for standard electrode layouts,
channelNames for channel labels
pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(300), nrow = 100, ncol = 3)), colData = S4Vectors::DataFrame(label = c("Fz", "Cz", "Pz")), samplingRate = 100 ) pe <- applyMontage(pe, "10-20") getElectrodePositions(pe)pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(300), nrow = 100, ncol = 3)), colData = S4Vectors::DataFrame(label = c("Fz", "Cz", "Pz")), samplingRate = 100 ) pe <- applyMontage(pe, "10-20") getElectrodePositions(pe)
Get events from a PhysioExperiment object
getEvents(x, type = NULL)getEvents(x, type = NULL)
x |
A PhysioExperiment object. |
type |
Optional character vector of event types to filter. |
A PhysioEvents object or DataFrame of events.
Delorme A, Makeig S (2004). "EEGLAB: an open source toolbox for analysis of single-trial EEG dynamics." Journal of Neuroscience Methods, 134(1), 9-21.
Oostenveld R, Fries P, Maris E, Schoffelen JM (2011). "FieldTrip: Open source software for advanced analysis of MEG, EEG, and invasive electrophysiological data." Computational Intelligence and Neuroscience, 2011, 156869.
setEvents for attaching events,
addEvents for appending events,
removeEvents for removing events,
nEvents for event count
# Create PhysioExperiment with events pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(1000), nrow = 100)), samplingRate = 100 ) events <- PhysioEvents( onset = c(1, 2, 3), type = c("stimulus", "response", "stimulus") ) pe <- setEvents(pe, events) # Get all events getEvents(pe) # Get only stimulus events getEvents(pe, type = "stimulus")# Create PhysioExperiment with events pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(1000), nrow = 100)), samplingRate = 100 ) events <- PhysioEvents( onset = c(1, 2, 3), type = c("stimulus", "response", "stimulus") ) pe <- setEvents(pe, events) # Get all events getEvents(pe) # Get only stimulus events getEvents(pe, type = "stimulus")
Get reference electrode
getReference(x)getReference(x)
x |
A PhysioExperiment object. |
Character string of reference electrode or NULL.
Oostenveld R, Fries P, Maris E, Schoffelen JM (2011). "FieldTrip: Open source software for advanced analysis of MEG, EEG, and invasive electrophysiological data." Computational Intelligence and Neuroscience, 2011, 156869.
setReference for setting the reference,
channelInfo for full channel metadata
pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), samplingRate = 100 ) pe <- setReference(pe, "Cz") getReference(pe) # "Cz"pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), samplingRate = 100 ) pe <- setReference(pe, "Cz") getReference(pe) # "Cz"
Provides various strategies for handling NA values in signal data.
handleNA( x, method = c("interpolate", "omit", "zero", "mean", "locf", "none"), ... )handleNA( x, method = c("interpolate", "omit", "zero", "mean", "locf", "none"), ... )
x |
Numeric vector or matrix. |
method |
Method for handling NA: "omit" (remove), "interpolate" (linear), "zero" (replace with 0), "mean" (replace with mean), "locf" (last observation carried forward), or "none" (no action). |
... |
Additional arguments passed to interpolation methods. |
Data with NA values handled according to the specified method.
Oostenveld R, Fries P, Maris E, Schoffelen JM (2011). "FieldTrip: Open source software for advanced analysis of MEG, EEG, and invasive electrophysiological data." Computational Intelligence and Neuroscience, 2011, 156869.
replaceNA for handling NA in PhysioExperiment assays,
fillEdgeNA for edge-specific NA filling,
checkNA for NA validation
x <- c(1, NA, 3, NA, 5) # Linear interpolation handleNA(x, method = "interpolate") # Replace with mean handleNA(x, method = "mean") # Last observation carried forward handleNA(x, method = "locf")x <- c(1, NA, 3, NA, 5) # Linear interpolation handleNA(x, method = "interpolate") # Replace with mean handleNA(x, method = "mean") # Last observation carried forward handleNA(x, method = "locf")
Quick check for NA presence in PhysioExperiment data.
hasNA(x, assay_name = NULL)hasNA(x, assay_name = NULL)
x |
A PhysioExperiment object. |
assay_name |
Optional specific assay to check. |
Logical indicating presence of NA values.
Oostenveld R, Fries P, Maris E, Schoffelen JM (2011). "FieldTrip: Open source software for advanced analysis of MEG, EEG, and invasive electrophysiological data." Computational Intelligence and Neuroscience, 2011, 156869.
checkNA for detailed NA statistics,
naSummary for per-assay NA summary,
replaceNA for handling NA values
pe <- PhysioExperiment( assays = list(raw = matrix(1:4, nrow = 2)), samplingRate = 100 ) hasNA(pe)pe <- PhysioExperiment( assays = list(raw = matrix(1:4, nrow = 2)), samplingRate = 100 ) hasNA(pe)
Returns the number of time points (rows) in the default assay.
## S4 method for signature 'PhysioExperiment' length(x)## S4 method for signature 'PhysioExperiment' length(x)
x |
A PhysioExperiment object. |
Integer scalar giving the number of time points (rows) in the
default assay, or 0L if no assays are present.
Huber, W., et al. (2015). "Orchestrating high-throughput genomic analysis with Bioconductor." Nature Methods, 12(2), 115-121. doi:10.1038/nmeth.3252
Morgan, M., et al. (2022). "S4Vectors: Foundation of vector-like and list-like containers in Bioconductor." R package.
dim,PhysioExperiment-method for full dimensions,
nChannels for the number of channels,
duration for duration in seconds
pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), samplingRate = 100 ) length(pe) # 100pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), samplingRate = 100 ) length(pe) # 100
Returns a summary of NA values across all assays.
naSummary(x)naSummary(x)
x |
A PhysioExperiment object. |
A data.frame with NA statistics for each assay.
Oostenveld R, Fries P, Maris E, Schoffelen JM (2011). "FieldTrip: Open source software for advanced analysis of MEG, EEG, and invasive electrophysiological data." Computational Intelligence and Neuroscience, 2011, 156869.
hasNA for quick NA check,
checkNA for detailed NA validation,
replaceNA for handling NA values
pe <- PhysioExperiment( assays = list( raw = matrix(c(1, NA, 3, 4), nrow = 2), filtered = matrix(1:4, nrow = 2) ), samplingRate = 100 ) naSummary(pe)pe <- PhysioExperiment( assays = list( raw = matrix(c(1, NA, 3, 4), nrow = 2), filtered = matrix(1:4, nrow = 2) ), samplingRate = 100 ) naSummary(pe)
Get number of channels
nChannels(x)nChannels(x)
x |
A PhysioExperiment object. |
Integer number of channels.
Oostenveld R, Fries P, Maris E, Schoffelen JM (2011). "FieldTrip: Open source software for advanced analysis of MEG, EEG, and invasive electrophysiological data." Computational Intelligence and Neuroscience, 2011, 156869.
channelNames for channel labels,
channelInfo for full channel metadata,
pickChannels for subsetting channels
pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), samplingRate = 100 ) nChannels(pe) # 4pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), samplingRate = 100 ) nChannels(pe) # 4
Get number of events
nEvents(x)nEvents(x)
x |
A PhysioEvents object. |
Integer count of events.
Delorme A, Makeig S (2004). "EEGLAB: an open source toolbox for analysis of single-trial EEG dynamics." Journal of Neuroscience Methods, 134(1), 9-21.
getEvents for retrieving events,
PhysioEvents for the event constructor,
addEvents for appending events
Create a PhysioEvents object
PhysioEvents( onset = numeric(0), duration = numeric(0), type = character(0), value = character(0) )PhysioEvents( onset = numeric(0), duration = numeric(0), type = character(0), value = character(0) )
onset |
Numeric vector of event onset times in seconds. |
duration |
Numeric vector of event durations in seconds. |
type |
Character vector of event types (e.g., "stimulus", "response"). |
value |
Character vector of event values/labels. |
A PhysioEvents object.
Delorme A, Makeig S (2004). "EEGLAB: an open source toolbox for analysis of single-trial EEG dynamics." Journal of Neuroscience Methods, 134(1), 9-21.
Oostenveld R, Fries P, Maris E, Schoffelen JM (2011). "FieldTrip: Open source software for advanced analysis of MEG, EEG, and invasive electrophysiological data." Computational Intelligence and Neuroscience, 2011, 156869.
setEvents for attaching events to a PhysioExperiment,
getEvents for retrieving events,
nEvents for event count
# Create events for a simple experiment events <- PhysioEvents( onset = c(1.0, 2.5, 4.0, 5.5), duration = c(0.5, 0.5, 0.5, 0.5), type = c("stimulus", "response", "stimulus", "response"), value = c("target", "hit", "distractor", "false_alarm") ) events # Create events with single type stim_events <- PhysioEvents( onset = c(1, 2, 3, 4, 5), type = "stimulus" )# Create events for a simple experiment events <- PhysioEvents( onset = c(1.0, 2.5, 4.0, 5.5), duration = c(0.5, 0.5, 0.5, 0.5), type = c("stimulus", "response", "stimulus", "response"), value = c("target", "hit", "distractor", "false_alarm") ) events # Create events with single type stim_events <- PhysioEvents( onset = c(1, 2, 3, 4, 5), type = "stimulus" )
Functions for managing experimental events (triggers, markers, annotations) within PhysioExperiment objects. PhysioEvents class
A simple S4 class to store event information as a DataFrame.
eventsA DataFrame containing event information with columns: onset (numeric), duration (numeric), type (character), value (character).
Creates a new PhysioExperiment instance, which extends
SummarizedExperiment with a samplingRate slot for
physiological signal data.
PhysioExperiment( assays = S4Vectors::SimpleList(), rowData = NULL, colData = NULL, metadata = list(), samplingRate = as.numeric(NA) )PhysioExperiment( assays = S4Vectors::SimpleList(), rowData = NULL, colData = NULL, metadata = list(), samplingRate = as.numeric(NA) )
assays |
A |
rowData |
Feature-level metadata as a |
colData |
Sample-level metadata as a |
metadata |
Optional experiment-level metadata list. |
samplingRate |
Numeric scalar sampling rate in Hz. |
A PhysioExperiment object containing the supplied assays,
row/column metadata, and sampling rate.
Huber, W., et al. (2015). "Orchestrating high-throughput genomic analysis with Bioconductor." Nature Methods, 12(2), 115-121. doi:10.1038/nmeth.3252
Morgan, M., et al. (2022). "S4Vectors: Foundation of vector-like and list-like containers in Bioconductor." R package.
samplingRate for accessing the sampling rate,
defaultAssay for retrieving the first assay name,
channelInfo for channel metadata,
setEvents for attaching event information
# Create a simple PhysioExperiment with random EEG-like data # 1000 time points, 4 channels eeg_data <- matrix(rnorm(1000 * 4), nrow = 1000, ncol = 4) colnames(eeg_data) <- c("Fz", "Cz", "Pz", "Oz") pe <- PhysioExperiment( assays = list(raw = eeg_data), colData = S4Vectors::DataFrame( label = c("Fz", "Cz", "Pz", "Oz"), type = rep("EEG", 4) ), samplingRate = 250 ) pe # Access sampling rate samplingRate(pe) # Create with multiple assays pe2 <- PhysioExperiment( assays = list(raw = eeg_data, filtered = eeg_data * 0.5), samplingRate = 500 )# Create a simple PhysioExperiment with random EEG-like data # 1000 time points, 4 channels eeg_data <- matrix(rnorm(1000 * 4), nrow = 1000, ncol = 4) colnames(eeg_data) <- c("Fz", "Cz", "Pz", "Oz") pe <- PhysioExperiment( assays = list(raw = eeg_data), colData = S4Vectors::DataFrame( label = c("Fz", "Cz", "Pz", "Oz"), type = rep("EEG", 4) ), samplingRate = 250 ) pe # Access sampling rate samplingRate(pe) # Create with multiple assays pe2 <- PhysioExperiment( assays = list(raw = eeg_data, filtered = eeg_data * 0.5), samplingRate = 500 )
The PhysioExperiment class extends SummarizedExperiment to store
multi-modal physiological signal data alongside metadata such as sampling
rate. This file defines the class, its validity checks, and the
user-facing constructor.
samplingRateNumeric scalar describing the acquisition frequency in Hz.
Huber, W., et al. (2015). "Orchestrating high-throughput genomic analysis with Bioconductor." Nature Methods, 12(2), 115-121. doi:10.1038/nmeth.3252
Morgan, M., et al. (2022). "S4Vectors: Foundation of vector-like and list-like containers in Bioconductor." R package.
PhysioExperiment for the constructor,
samplingRate for accessing the sampling rate,
channelInfo for channel metadata
Creates a new PhysioExperiment with only selected channels.
pickChannels(x, channels)pickChannels(x, channels)
x |
A PhysioExperiment object. |
channels |
Integer indices or character names of channels to keep. |
A new PhysioExperiment with selected channels.
Oostenveld R, Fries P, Maris E, Schoffelen JM (2011). "FieldTrip: Open source software for advanced analysis of MEG, EEG, and invasive electrophysiological data." Computational Intelligence and Neuroscience, 2011, 156869.
dropChannels for removing channels,
getChannelsByType for finding channels by type,
channelNames for available channel labels
pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), colData = S4Vectors::DataFrame(label = c("Fz", "Cz", "Pz", "Oz")), samplingRate = 100 ) # Pick by index pe_subset <- pickChannels(pe, c(1, 3)) nChannels(pe_subset) # 2 # Pick by name pe_frontal <- pickChannels(pe, c("Fz", "Cz"))pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), colData = S4Vectors::DataFrame(label = c("Fz", "Cz", "Pz", "Oz")), samplingRate = 100 ) # Pick by index pe_subset <- pickChannels(pe, c(1, 3)) nChannels(pe_subset) # 2 # Pick by name pe_frontal <- pickChannels(pe, c("Fz", "Cz"))
Concatenates two PhysioExperiment objects along the time (row) axis.
Both objects must have the same number of channels and matching sampling
rates. Event onsets in y are offset by the duration of x.
rbindPhysio(x, y)rbindPhysio(x, y)
x |
A PhysioExperiment object. |
y |
A PhysioExperiment object to concatenate. |
A PhysioExperiment object with time points from both
x and y concatenated, combined rowData, and merged events.
Huber, W., et al. (2015). "Orchestrating high-throughput genomic analysis with Bioconductor." Nature Methods, 12(2), 115-121. doi:10.1038/nmeth.3252
Morgan, M., et al. (2022). "S4Vectors: Foundation of vector-like and list-like containers in Bioconductor." R package.
cbindPhysio for combining along the channel axis,
extractWindow for extracting a time window,
[ for general subsetting
pe1 <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), samplingRate = 100 ) pe2 <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), samplingRate = 100 ) # Concatenate in time pe_concat <- rbindPhysio(pe1, pe2) length(pe_concat) # 200pe1 <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), samplingRate = 100 ) pe2 <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), samplingRate = 100 ) # Concatenate in time pe_concat <- rbindPhysio(pe1, pe2) length(pe_concat) # 200
Remove events from a PhysioExperiment object
removeEvents(x, type = NULL, indices = NULL)removeEvents(x, type = NULL, indices = NULL)
x |
A PhysioExperiment object. |
type |
Optional event types to remove. If NULL, removes all events. |
indices |
Optional integer indices of events to remove. |
The modified PhysioExperiment object.
Delorme A, Makeig S (2004). "EEGLAB: an open source toolbox for analysis of single-trial EEG dynamics." Journal of Neuroscience Methods, 134(1), 9-21.
Oostenveld R, Fries P, Maris E, Schoffelen JM (2011). "FieldTrip: Open source software for advanced analysis of MEG, EEG, and invasive electrophysiological data." Computational Intelligence and Neuroscience, 2011, 156869.
getEvents for retrieving events,
addEvents for appending events,
setEvents for replacing all events
Rename channels
renameChannels(x, old_names, new_names)renameChannels(x, old_names, new_names)
x |
A PhysioExperiment object. |
old_names |
Character vector of current names. |
new_names |
Character vector of new names. |
Modified PhysioExperiment object.
Oostenveld R, Fries P, Maris E, Schoffelen JM (2011). "FieldTrip: Open source software for advanced analysis of MEG, EEG, and invasive electrophysiological data." Computational Intelligence and Neuroscience, 2011, 156869.
channelNames for reading channel labels,
channelInfo for full channel metadata,
pickChannels for subsetting channels
pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), colData = S4Vectors::DataFrame(label = c("Fz", "Cz", "Pz", "Oz")), samplingRate = 100 ) # Rename channels pe <- renameChannels(pe, c("Fz", "Cz"), c("F3", "C3")) channelNames(pe)pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), colData = S4Vectors::DataFrame(label = c("Fz", "Cz", "Pz", "Oz")), samplingRate = 100 ) # Rename channels pe <- renameChannels(pe, c("Fz", "Cz"), c("F3", "C3")) channelNames(pe)
Creates a new assay with NA values handled according to the specified method.
replaceNA( x, method = "interpolate", input_assay = NULL, output_assay = "na_handled" )replaceNA( x, method = "interpolate", input_assay = NULL, output_assay = "na_handled" )
x |
A PhysioExperiment object. |
method |
Method for handling NA (see handleNA). |
input_assay |
Input assay name. If NULL, uses default assay. |
output_assay |
Output assay name. Default is "na_handled". |
Modified PhysioExperiment with new assay.
Oostenveld R, Fries P, Maris E, Schoffelen JM (2011). "FieldTrip: Open source software for advanced analysis of MEG, EEG, and invasive electrophysiological data." Computational Intelligence and Neuroscience, 2011, 156869.
handleNA for the underlying NA handling strategies,
checkNA for NA validation,
hasNA for quick NA presence check
pe <- PhysioExperiment( assays = list(raw = matrix(c(1, NA, 3, NA, 5, 6), nrow = 3)), samplingRate = 100 ) # Interpolate NA values pe <- replaceNA(pe, method = "interpolate")pe <- PhysioExperiment( assays = list(raw = matrix(c(1, NA, 3, NA, 5, 6), nrow = 3)), samplingRate = 100 ) # Interpolate NA values pe <- replaceNA(pe, method = "interpolate")
Convert sample indices to times
samplesToTime(x, samples)samplesToTime(x, samples)
x |
A PhysioExperiment object. |
samples |
Integer vector of sample indices. |
Numeric vector of times in seconds.
Delorme A, Makeig S (2004). "EEGLAB: an open source toolbox for analysis of single-trial EEG dynamics." Journal of Neuroscience Methods, 134(1), 9-21.
timeToSamples for the inverse conversion,
samplingRate for the sampling rate,
timeIndex for the full time vector
These helper functions expose common slots and derived quantities for
PhysioExperiment objects.
Get or set sampling rate
samplingRate(x) samplingRate(x) <- value ## S4 replacement method for signature 'PhysioExperiment' samplingRate(x) <- valuesamplingRate(x) samplingRate(x) <- value ## S4 replacement method for signature 'PhysioExperiment' samplingRate(x) <- value
x |
A PhysioExperiment object. |
value |
Numeric scalar for the new sampling rate in Hz. |
For samplingRate(x): a numeric scalar giving the sampling
rate in Hz. For samplingRate(x) <- value: the modified
PhysioExperiment object (returned invisibly).
Huber, W., et al. (2015). "Orchestrating high-throughput genomic analysis with Bioconductor." Nature Methods, 12(2), 115-121. doi:10.1038/nmeth.3252
Morgan, M., et al. (2022). "S4Vectors: Foundation of vector-like and list-like containers in Bioconductor." R package.
PhysioExperiment for the constructor,
defaultAssay for the default assay name,
duration for signal duration,
timeIndex for time point vector
# Create example data pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(100), nrow = 10)), samplingRate = 250 ) # Get sampling rate samplingRate(pe) # Set sampling rate samplingRate(pe) <- 500 samplingRate(pe)# Create example data pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(100), nrow = 10)), samplingRate = 250 ) # Get sampling rate samplingRate(pe) # Set sampling rate samplingRate(pe) <- 500 samplingRate(pe)
Assigns types (EEG, EMG, EOG, etc.) to channels.
setChannelTypes(x, types)setChannelTypes(x, types)
x |
A PhysioExperiment object. |
types |
Named character vector or list mapping channel names/indices to types. If unnamed, applies types in order. |
Modified PhysioExperiment object.
Oostenveld R, Fries P, Maris E, Schoffelen JM (2011). "FieldTrip: Open source software for advanced analysis of MEG, EEG, and invasive electrophysiological data." Computational Intelligence and Neuroscience, 2011, 156869.
getChannelsByType for querying channels by type,
channelInfo for full channel metadata,
setChannelUnits for assigning physical units
pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), colData = S4Vectors::DataFrame(label = c("Fz", "EOG1", "EMG1", "Oz")), samplingRate = 100 ) # Set all channels to same type pe <- setChannelTypes(pe, "EEG") # Set specific channel types by name pe <- setChannelTypes(pe, c(EOG1 = "EOG", EMG1 = "EMG"))pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), colData = S4Vectors::DataFrame(label = c("Fz", "EOG1", "EMG1", "Oz")), samplingRate = 100 ) # Set all channels to same type pe <- setChannelTypes(pe, "EEG") # Set specific channel types by name pe <- setChannelTypes(pe, c(EOG1 = "EOG", EMG1 = "EMG"))
Assigns physical units to channels.
setChannelUnits(x, units)setChannelUnits(x, units)
x |
A PhysioExperiment object. |
units |
Character vector or named list of units. |
Modified PhysioExperiment object.
Oostenveld R, Fries P, Maris E, Schoffelen JM (2011). "FieldTrip: Open source software for advanced analysis of MEG, EEG, and invasive electrophysiological data." Computational Intelligence and Neuroscience, 2011, 156869.
setChannelTypes for assigning channel types,
channelInfo for full channel metadata
pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), samplingRate = 100 ) # Set all channels to same unit pe <- setChannelUnits(pe, "uV")pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), samplingRate = 100 ) # Set all channels to same unit pe <- setChannelUnits(pe, "uV")
Assigns 3D electrode positions to channels.
setElectrodePositions(x, positions)setElectrodePositions(x, positions)
x |
A PhysioExperiment object. |
positions |
A data.frame or matrix with columns x, y, z and rows matching channels. Row names should match channel names. |
Modified PhysioExperiment object.
Oostenveld R, Fries P, Maris E, Schoffelen JM (2011). "FieldTrip: Open source software for advanced analysis of MEG, EEG, and invasive electrophysiological data." Computational Intelligence and Neuroscience, 2011, 156869.
getElectrodePositions for reading positions,
applyMontage for standard electrode layouts,
channelInfo for full channel metadata
pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(300), nrow = 100, ncol = 3)), colData = S4Vectors::DataFrame(label = c("Fz", "Cz", "Pz")), samplingRate = 100 ) # Set electrode positions positions <- data.frame( x = c(0, 0, 0), y = c(0.71, 0, -0.71), z = c(0.71, 1, 0.71) ) pe <- setElectrodePositions(pe, positions)pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(300), nrow = 100, ncol = 3)), colData = S4Vectors::DataFrame(label = c("Fz", "Cz", "Pz")), samplingRate = 100 ) # Set electrode positions positions <- data.frame( x = c(0, 0, 0), y = c(0.71, 0, -0.71), z = c(0.71, 1, 0.71) ) pe <- setElectrodePositions(pe, positions)
Set events for a PhysioExperiment object
setEvents(x, events)setEvents(x, events)
x |
A PhysioExperiment object. |
events |
A PhysioEvents object or a data.frame with columns: onset, duration, type, value. |
The modified PhysioExperiment object.
Delorme A, Makeig S (2004). "EEGLAB: an open source toolbox for analysis of single-trial EEG dynamics." Journal of Neuroscience Methods, 134(1), 9-21.
Oostenveld R, Fries P, Maris E, Schoffelen JM (2011). "FieldTrip: Open source software for advanced analysis of MEG, EEG, and invasive electrophysiological data." Computational Intelligence and Neuroscience, 2011, 156869.
getEvents for retrieving events,
addEvents for appending events,
PhysioEvents for the event constructor
pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(1000), nrow = 100)), samplingRate = 100 ) # Set events using PhysioEvents object events <- PhysioEvents(onset = c(1, 2, 3), type = "stimulus") pe <- setEvents(pe, events) # Set events using data.frame pe <- setEvents(pe, data.frame(onset = c(1, 2), type = "response"))pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(1000), nrow = 100)), samplingRate = 100 ) # Set events using PhysioEvents object events <- PhysioEvents(onset = c(1, 2, 3), type = "stimulus") pe <- setEvents(pe, events) # Set events using data.frame pe <- setEvents(pe, data.frame(onset = c(1, 2), type = "response"))
Records the reference electrode used for the recording.
setReference(x, reference)setReference(x, reference)
x |
A PhysioExperiment object. |
reference |
Character string naming the reference electrode. |
Modified PhysioExperiment object.
Oostenveld R, Fries P, Maris E, Schoffelen JM (2011). "FieldTrip: Open source software for advanced analysis of MEG, EEG, and invasive electrophysiological data." Computational Intelligence and Neuroscience, 2011, 156869.
getReference for reading the reference,
channelInfo for full channel metadata,
applyMontage for applying standard montages
pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), samplingRate = 100 ) # Set reference electrode pe <- setReference(pe, "average") getReference(pe) # "average"pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), samplingRate = 100 ) # Set reference electrode pe <- setReference(pe, "average") getReference(pe) # "average"
Show method for PhysioEvents
## S4 method for signature 'PhysioEvents' show(object)## S4 method for signature 'PhysioEvents' show(object)
object |
A PhysioEvents object. |
PhysioEvents for the constructor,
nEvents for event count
Standard S4 methods for PhysioExperiment objects including show, subsetting, and combining. Show method for PhysioExperiment
## S4 method for signature 'PhysioExperiment' show(object)## S4 method for signature 'PhysioExperiment' show(object)
object |
A PhysioExperiment object. |
Displays a summary of the PhysioExperiment object.
Invisibly returns NULL. Called for its side effect of
printing a human-readable summary to the console.
Huber, W., et al. (2015). "Orchestrating high-throughput genomic analysis with Bioconductor." Nature Methods, 12(2), 115-121. doi:10.1038/nmeth.3252
Morgan, M., et al. (2022). "S4Vectors: Foundation of vector-like and list-like containers in Bioconductor." R package.
PhysioExperiment for the constructor,
summary,PhysioExperiment-method for channel-level statistics,
as.data.frame,PhysioExperiment-method for conversion to data.frame
pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), colData = S4Vectors::DataFrame(label = c("Fz", "Cz", "Pz", "Oz")), samplingRate = 100 ) pe # Displays summarype <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), colData = S4Vectors::DataFrame(label = c("Fz", "Cz", "Pz", "Oz")), samplingRate = 100 ) pe # Displays summary
Computes per-channel summary statistics (min, max, mean, sd, median) for the default assay. For 3D arrays, values are first averaged across the third dimension.
## S4 method for signature 'PhysioExperiment' summary(object, ...)## S4 method for signature 'PhysioExperiment' summary(object, ...)
object |
A PhysioExperiment object. |
... |
Additional arguments (not used). |
A data.frame with columns channel, min,
max, mean, sd, and median, with one row
per channel. Returns an empty data.frame if no assays are present.
R Core Team (2024). "R: A Language and Environment for Statistical Computing." R Foundation for Statistical Computing, Vienna, Austria.
PhysioExperiment for the constructor,
as.data.frame,PhysioExperiment-method for full data export,
channelNames for channel labels
pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), colData = S4Vectors::DataFrame(label = c("Fz", "Cz", "Pz", "Oz")), samplingRate = 100 ) summary(pe)pe <- PhysioExperiment( assays = list(raw = matrix(rnorm(400), nrow = 100, ncol = 4)), colData = S4Vectors::DataFrame(label = c("Fz", "Cz", "Pz", "Oz")), samplingRate = 100 ) summary(pe)
Computes a time vector for the default assay using the object's sampling rate.
timeIndex(x)timeIndex(x)
x |
A |
Numeric vector of time points in seconds.
Oostenveld R, Fries P, Maris E, Schoffelen JM (2011). "FieldTrip: Open source software for advanced analysis of MEG, EEG, and invasive electrophysiological data." Computational Intelligence and Neuroscience, 2011, 156869.
samplingRate for the sampling rate,
duration for signal duration,
timeToSamples for converting times to sample indices
Convert event times to sample indices
timeToSamples(x, times)timeToSamples(x, times)
x |
A PhysioExperiment object. |
times |
Numeric vector of times in seconds. |
Integer vector of sample indices.
Delorme A, Makeig S (2004). "EEGLAB: an open source toolbox for analysis of single-trial EEG dynamics." Journal of Neuroscience Methods, 134(1), 9-21.
samplesToTime for the inverse conversion,
samplingRate for the sampling rate,
timeIndex for the full time vector