Skip to contents

Extracts, for each casualty in each replication, the ordered sequence of board areas visited.

Usage

sdt_decision_paths(run, format = c("long", "wide"))

Arguments

run

A game_run from sdt_simulate().

format

"long" for one row per casualty per step, or "wide" for one row per casualty per replication with a column per position. The wide form is the state-sequence (STS) layout sdt_seqdef() expects.

Every casualty appears in every replication. One the game was called before reaching gets a single-step path of "not_seen" rather than being left out: never being screened is a pathway the exercise produces and the source reports, and a sequence analysis that silently dropped those casualties would be computed on a different denominator than the one it claims.

Value

A tibble::tibble(). Long: replication, id, step, area, start, end, duration. Wide: replication, id, then step_1 to step_k, padded with NA for casualties whose path was shorter.

Examples

co <- sdt_synthetic_cohort(n = 10, seed = 1)
run <- sdt_simulate(sdt_scenario(co), replications = 2, seed = 1,
                    verbose = FALSE)
sdt_decision_paths(run)
#> # A tibble: 76 × 7
#>    replication id     step area         start   end duration
#>          <int> <chr> <int> <chr>        <dbl> <dbl>    <dbl>
#>  1           1 P001      1 triage        7.99  33.8    25.8 
#>  2           1 P001      2 ed_red       33.8   41.3     7.48
#>  3           1 P001      3 diagnostics  41.3   46.9     5.66
#>  4           1 P001      4 ed_red       46.9  173.    126.  
#>  5           1 P001      5 icu_imc     173.   197.     24.4 
#>  6           1 P002      1 triage       11.2   56.6    45.4 
#>  7           1 P002      2 ed_red       56.6   59.5     2.94
#>  8           1 P002      3 diagnostics  59.5  117.     57.5 
#>  9           1 P002      4 or          117.   168.     51.0 
#> 10           1 P002      5 icu_imc     168.   173.      4.47
#> # ℹ 66 more rows
sdt_decision_paths(run, format = "wide")
#> # A tibble: 20 × 7
#>    replication id    step_1 step_2     step_3      step_4    step_5 
#>          <int> <chr> <chr>  <chr>      <chr>       <chr>     <chr>  
#>  1           1 P001  triage ed_red     diagnostics ed_red    icu_imc
#>  2           1 P002  triage ed_red     diagnostics or        icu_imc
#>  3           1 P003  triage green_area NA          NA        NA     
#>  4           1 P004  triage ed_yellow  diagnostics ed_yellow NA     
#>  5           1 P005  triage ed_red     diagnostics or        icu_imc
#>  6           1 P006  triage ed_yellow  diagnostics ed_yellow ward   
#>  7           1 P007  triage ed_yellow  diagnostics ed_yellow NA     
#>  8           1 P008  triage green_area NA          NA        NA     
#>  9           1 P009  triage green_area NA          NA        NA     
#> 10           1 P010  triage ed_red     diagnostics or        icu_imc
#> 11           2 P001  triage ed_red     diagnostics or        icu_imc
#> 12           2 P002  triage ed_red     diagnostics or        icu_imc
#> 13           2 P003  triage green_area NA          NA        NA     
#> 14           2 P004  triage ed_yellow  diagnostics ed_yellow ward   
#> 15           2 P005  triage ed_red     diagnostics or        NA     
#> 16           2 P006  triage ed_yellow  diagnostics ed_yellow NA     
#> 17           2 P007  triage ed_yellow  diagnostics ed_yellow ward   
#> 18           2 P008  triage green_area NA          NA        NA     
#> 19           2 P009  triage green_area NA          NA        NA     
#> 20           2 P010  triage ed_red     diagnostics NA        NA