is_continuous: Check if a variable is continuous

View source: R/all_generic.R

is_continuousR Documentation

Check if a variable is continuous

Description

Determines if a variable represents continuous (numeric) rather than categorical data. For event terms, continuous variables are those that have numeric values (like amplitudes or modulators) rather than discrete factor levels. For example, reaction times would be continuous, while trial types would be categorical.

Usage

is_continuous(x)

Arguments

x

The object to check (typically an event_term, event_seq, or event_matrix)

Value

Logical; TRUE if the variable is continuous (numeric), FALSE if categorical

See Also

is_categorical(), event_term()

Other variable_type: is_categorical()

Examples

# Create event terms with different types

# Categorical event (factor)
event_data <- data.frame(
  condition = factor(c("A", "B", "A", "B")),
  onsets = c(1, 10, 20, 30),
  run = c(1, 1, 1, 1)
)
cat_term <- event_term(
  list(condition = event_data$condition),
  onsets = event_data$onsets,
  blockids = event_data$run
)
is_continuous(cat_term)  # Returns: FALSE

# Continuous event (numeric)
event_data$rt <- c(0.8, 1.2, 0.9, 1.1)  # reaction times
cont_term <- event_term(
  list(rt = event_data$rt),
  onsets = event_data$onsets,
  blockids = event_data$run
)
is_continuous(cont_term)  # Returns: TRUE

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