This function generates an event model term from a list of named variables, along with their onsets, block IDs, and durations. Optionally, a subset of onsets can be retained.
Arguments
- evlist
A list of named variables.
- onsets
A vector of onset times for the experimental events in seconds.
- blockids
A vector of block numbers associated with each onset.
- durations
A vector of event durations (default is 1).
- subset
A logical vector indicating the subset of onsets to retain (default is NULL).
Value
A list containing the following components:
varname: A character string representing the variable names, concatenated with colons.
events: A list of event variables.
subset: A logical vector indicating the retained onsets.
event_table: A tibble containing event information.
onsets: A vector of onset times.
blockids: A vector of block numbers.
durations: A vector of event durations.
Examples
x1 <- factor(rep(letters[1:3], 10))
x2 <- factor(rep(1:3, each=10))
eterm <- event_term(list(x1=x1,x2=x2), onsets=seq(1,100,length.out=30),
blockids=rep(1,30))
x1 <- rnorm(30)
x2 <- factor(rep(1:3, each=10))
eterm <- event_term(list(x1=x1,x2=x2), onsets=seq(1,100,length.out=30),
blockids=rep(1,30), subset=x1>0)