This is a user-facing wrapper around the internal event() constructor,
specifically for creating continuous event sequences from numeric matrices.
Arguments
- 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
onsetsin length and contain noNAvalues.Column names of
matare sanitized using.sanitizeName()before being stored. If they are missing or not unique, deterministic feature suffixes (f01,f02, ...) are generated instead. The resulting names are returned bylevels()for the event object.
Examples
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)
#>
#> ── Event Sequence: eset ────────────────────────────────────────────────────────
#> * Type: Continuous
#> * Columns: Val1, Val2
#> * Events: 10
#>
#> ── Timing ──
#>
#> * Onset Range: 1.00 - 100.00 sec
#> * Duration Range: 1.00 - 1.00 sec
#>
#> ── Blocks ──
#>
#> * Number of Blocks: 1
#> * Block IDs: 1
#>
#> ── Values ──
#>
#> * Value Range: -1.26 - 2.65
columns(eset) # Alias for levels
#> [1] "Val1" "Val2"