View source: R/event-classes.R
labels.event | R Documentation |
Returns a character vector of formatted labels for an event object,
using the Variable[Level]
style for categorical events,
Variable[Index]
for multi-column continuous events, or just
Variable
for single continuous events.
Useful for getting consistent labels for individual event components.
This is distinct from levels()
which returns the raw level names or column names.
Relies on the internal .level_vector
helper function.
## S3 method for class 'event'
labels(x, ...)
x |
An object of class |
... |
Additional arguments (unused). |
A character vector of formatted labels, or character(0)
if not applicable.
fac <- factor(rep(c("A", "B"), 3))
onsets <- 1:6
ev_fac <- event_factor(fac, "Condition", onsets)
labels(ev_fac) # Should return c("Condition[A]", "Condition[B]")
vals <- 1:6
ev_num <- event_variable(vals, "Modulator", onsets)
labels(ev_num) # Should return "Modulator"
mat <- matrix(1:12, 6, 2)
colnames(mat) <- c("C1", "C2")
ev_mat <- event_matrix(mat, "MatrixVar", onsets)
labels(ev_mat) # Should return c("MatrixVar[1]", "MatrixVar[2]")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.