event_term: Create an event model term from a named list of variables.

View source: R/event_vector.R

event_termR Documentation

Create an event model term from a named list of variables.

Description

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.

Usage

event_term(evlist, onsets, blockids, durations = 1, subset = NULL)

Arguments

evlist

A list of named variables.

onsets

Numeric vector of onset times (in seconds).

blockids

Numeric vector of block numbers.

durations

Numeric vector of event durations (default is 1).

subset

Logical vector indicating which onsets to retain (default is NULL).

Value

A list with components:

  • varname: concatenated variable names,

  • events: a list of event objects,

  • subset: the retained onsets,

  • event_table: a tibble with event information,

  • onsets, blockids, 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))


bbuchsbaum/fmrireg documentation built on March 1, 2025, 11:20 a.m.