Learn R Programming

Epoch (version 1.0.3)

resample: Generic function for resampling objects

Description

This function allows you to resample an object to a different sampling frequency.

This function allows you to resample an Epoch object to a different sampling frequency.

Usage

resample(x, ...)

# S4 method for Epoch resample(x, samplingRate, ...)

Value

An Epoch object with the resampled data.

Arguments

x

An Epoch object to be resampled.

...

Additional arguments passed to gsignal::resample

samplingRate

The new sampling frequency (unit: Hertz).

See Also

Other Epoch methods: coltimes(), crop(), plot,Epoch,missing-method, show,Epoch-method

Examples

Run this code
# Create an Epoch object
epoch_data <- matrix(rnorm(1000), nrow = 10)
rownames(epoch_data) <- paste0("Electrode_", 1:10)
epoch <- Epoch(epoch_data, startTime = 0, samplingRate = 100)

# downsample the epoch to 50 Hz
resample(epoch, samplingRate = 50)

# upsample the epoch to 200 Hz
resample(epoch, samplingRate = 200)

Run the code above in your browser using DataLab