View source: R/event-classes.R
event_matrix | R Documentation |
This is a user-facing wrapper around the internal event()
constructor,
specifically for creating continuous event sequences from numeric matrices.
event_matrix(mat, name, onsets, blockids = 1, durations = 0, subset = NULL)
mat |
A numeric matrix of continuous event values (one row per event). |
name |
Name of the event variable. |
onsets |
Numeric vector of event onsets (seconds). |
blockids |
Numeric vector of block IDs. |
durations |
Numeric vector of event durations (seconds), or a scalar. |
subset |
Optional logical vector indicating which events to keep. If
provided, the vector must match If |
An S3 object of class event
and event_seq
.
mat <- matrix(rnorm(20), 10, 2, dimnames=list(NULL, c("Val1", "Val2")))
onsets <- seq(1, 100, length.out = 10)
durations <- rep(1, 10)
blockids <- rep(1, 10)
eset <- event_matrix(mat, "eset", onsets, blockids, durations)
print(eset)
columns(eset) # Alias for levels
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.