| path_counts | R Documentation |
Counts the frequency of k-step paths (k-grams) across all trajectories. Useful for understanding which sequences dominate the data before applying formal models.
path_counts(data, k = 2L, top = NULL)
data |
A list of character vectors (trajectories) or a data.frame (rows = trajectories, columns = time points). |
k |
Integer. Length of the path / n-gram (default 2). A k of 2 counts individual transitions; k of 3 counts two-step paths, etc. |
top |
Integer or NULL. If set, returns only the top N most frequent paths (default NULL = all). |
A data frame with columns: path, count,
proportion.
trajs <- list(c("A","B","C","D"), c("A","B","D","C"))
path_counts(trajs, k = 2)
path_counts(trajs, k = 3, top = 10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.