Skip to contents

Convert event times to sample indices

Usage

timeToSamples(x, times)

Arguments

x

A PhysioExperiment object.

times

Numeric vector of times in seconds.

Value

Integer vector of sample indices.

References

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.

See also

samplesToTime for the inverse conversion, samplingRate for the sampling rate, timeIndex for the full time vector

Examples

pe <- PhysioExperiment(
  assays = list(raw = matrix(rnorm(1000), nrow = 100)),
  samplingRate = 100
)
timeToSamples(pe, c(0, 0.5, 1))
#> [1]   1  51 101