# Create a simple events data frame
events <- data.frame(
subjects = rep(1, 10),
run = rep(1, 10),
onset = seq(0, 90, by = 10),
condition = rep(c("A", "B"), 5),
rt = runif(10, 0.5, 1.5),
accuracy = sample(0:1, 10, replace = TRUE)
)
# Reshape with default duration
reshaped1 <- reshape_events(events, event_types = c("condition", "accuracy"))
# Reshape with custom duration for each event_type
reshaped2 <- reshape_events(events,
event_types = c("condition", "accuracy", "rt"),
duration = list(condition = 0.5,
accuracy = 0.2,
rt = function(x) x$rt))
Run the code above in your browser using DataLab