View source: R/educational_sequences.R
| encode_sequences | R Documentation |
One-hot encode long-form sequence states
encode_sequences(
data,
id = "id",
period = "period",
state = "state",
prefix = "state_"
)
data |
Long-form sequence data. |
id, period, state |
Column names. |
prefix |
Generated state-column prefix. |
A simulab_sim base data.frame with one row per input row: every
input column except state, followed by one 0/1 indicator column per
observed state. A mapping table (state, column) is available through
as.data.frame().
data <- simulate_sequences(n = 10, n_states = 3, chain_length = 5, seed = 1)
head(encode_sequences(data))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.