Skip to contents

Long format to transition matrix

Usage

long_to_transmat(dat, val_col = "prob")

Arguments

dat

array of from, to, prob, vals

val_col

Name of value column; default prob (string)

Value

Transition matrix

Examples

dat <- data.frame(from = c(NA,1, 1),
                  to = c(1, 2, 3),
                  prob = c(NA, 0.5, 0.5),
                  vals = c(0, 1, 2))
long_to_transmat(dat)
#>    1   2   3
#> 1 NA 0.5 0.5
#> 2 NA  NA  NA
#> 3 NA  NA  NA