View source: R/sequence-panel.R
| prepare_sequence_panel | R Documentation |
Validates a collection of sequences observed repeatedly for the same panel units and creates an auditable panel index. Each sequence must map to exactly one panel unit and one occasion.
prepare_sequence_panel(
data,
panel_id_col,
occasion_col,
sequence_id_col = "sequence_id",
order_col = "sequence_order",
state_col = "state",
metadata_cols = NULL,
require_unique_occasions = TRUE
)
data |
Long-format sequence data or a prepared gp3sequences result. |
panel_id_col |
Column identifying the repeatedly observed unit. |
occasion_col |
Column identifying the wave, visit, or occasion. |
sequence_id_col, order_col, state_col |
Core sequence columns. |
metadata_cols |
Optional columns that must remain constant within each sequence. |
require_unique_occasions |
Require at most one sequence per panel unit and occasion. |
An object of class gp3_sequence_panel containing canonical data,
a panel index, state levels, and mapping information.
panel <- data.frame(
participant_id = rep(c("p1", "p2"), each = 8L),
occasion = rep(rep(c(1, 2), each = 4L), times = 2L),
sequence_id = rep(c("p1_w1", "p1_w2", "p2_w1", "p2_w2"), each = 4L),
sequence_order = rep(1:4, times = 4L),
state = c("A", "B", "C", "D", "A", "C", "C", "D",
"D", "C", "B", "A", "D", "B", "B", "A")
)
prepare_sequence_panel(panel, "participant_id", "occasion")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.