Construct a precedence matrix, showing how activities are followed by each other. This function computes the precedence matrix directly in C++ for efficiency. Only the type absolute of (precedence_matrix) is supported.

precedence_matrix_absolute(eventlog, lead = 1)

Arguments

eventlog

The event log object to be used.

lead

The distance between activities following/preceding each other.

Examples

library(eventdataR)
data(traffic_fines)
m <- precedence_matrix_absolute(traffic_fines)
print(m)
#> # A tibble: 47 × 3
#>    antecedent                            consequent                            n
#>    <fct>                                 <fct>                             <int>
#>  1 Payment                               Insert Fine Notification              1
#>  2 Receive Result Appeal from Prefecture Payment                               1
#>  3 Send for Credit Collection            Send Appeal to Prefecture             3
#>  4 Add penalty                           Notify Result Appeal to Offender      3
#>  5 Receive Result Appeal from Prefecture Add penalty                           2
#>  6 Notify Result Appeal to Offender      End                                   1
#>  7 Payment                               Receive Result Appeal from Prefe…     1
#>  8 Insert Fine Notification              Appeal to Judge                      14
#>  9 Insert Date Appeal to Prefecture      Insert Fine Notification              1
#> 10 Notify Result Appeal to Offender      Receive Result Appeal from Prefe…     1
#> # … with 37 more rows
#> # ℹ Use `print(n = ...)` to see more rows
as.matrix(m)
#>                                        consequent
#> antecedent                              Add penalty Appeal to Judge Create Fine
#>   Add penalty                                     0               0           0
#>   Appeal to Judge                                13               0           0
#>   Create Fine                                     0               0           0
#>   End                                             0               0           0
#>   Insert Date Appeal to Prefecture              170               0           0
#>   Insert Fine Notification                     4417              14           0
#>   Notify Result Appeal to Offender                3               5           0
#>   Payment                                        18               0           0
#>   Receive Result Appeal from Prefecture           2               0           0
#>   Send Appeal to Prefecture                      12               0           0
#>   Send Fine                                       0               0           0
#>   Send for Credit Collection                      0               0           0
#>   Start                                           0               0       10000
#>                                        consequent
#> antecedent                               End Insert Date Appeal to Prefecture
#>   Add penalty                              0                               41
#>   Appeal to Judge                          5                                1
#>   Create Fine                              0                                0
#>   End                                      0                                0
#>   Insert Date Appeal to Prefecture         0                                0
#>   Insert Fine Notification                 0                              188
#>   Notify Result Appeal to Offender         1                                0
#>   Payment                               4535                                0
#>   Receive Result Appeal from Prefecture    0                                0
#>   Send Appeal to Prefecture              182                                0
#>   Send Fine                             1893                                2
#>   Send for Credit Collection            3384                                0
#>   Start                                    0                                0
#>                                        consequent
#> antecedent                              Insert Fine Notification
#>   Add penalty                                                  0
#>   Appeal to Judge                                              0
#>   Create Fine                                                  0
#>   End                                                          0
#>   Insert Date Appeal to Prefecture                             1
#>   Insert Fine Notification                                     0
#>   Notify Result Appeal to Offender                             0
#>   Payment                                                      1
#>   Receive Result Appeal from Prefecture                        0
#>   Send Appeal to Prefecture                                    0
#>   Send Fine                                                 4633
#>   Send for Credit Collection                                   0
#>   Start                                                        0
#>                                        consequent
#> antecedent                              Notify Result Appeal to Offender
#>   Add penalty                                                          3
#>   Appeal to Judge                                                      0
#>   Create Fine                                                          0
#>   End                                                                  0
#>   Insert Date Appeal to Prefecture                                     0
#>   Insert Fine Notification                                             0
#>   Notify Result Appeal to Offender                                     0
#>   Payment                                                              0
#>   Receive Result Appeal from Prefecture                               51
#>   Send Appeal to Prefecture                                            0
#>   Send Fine                                                            0
#>   Send for Credit Collection                                           0
#>   Start                                                                0
#>                                        consequent
#> antecedent                              Payment
#>   Add penalty                              1117
#>   Appeal to Judge                             0
#>   Create Fine                              3443
#>   End                                         0
#>   Insert Date Appeal to Prefecture            3
#>   Insert Fine Notification                   16
#>   Notify Result Appeal to Offender           24
#>   Payment                                   264
#>   Receive Result Appeal from Prefecture       1
#>   Send Appeal to Prefecture                   0
#>   Send Fine                                  42
#>   Send for Credit Collection                  0
#>   Start                                       0
#>                                        consequent
#> antecedent                              Receive Result Appeal from Prefecture
#>   Add penalty                                                              15
#>   Appeal to Judge                                                           0
#>   Create Fine                                                               0
#>   End                                                                       0
#>   Insert Date Appeal to Prefecture                                          5
#>   Insert Fine Notification                                                  0
#>   Notify Result Appeal to Offender                                          1
#>   Payment                                                                   1
#>   Receive Result Appeal from Prefecture                                     0
#>   Send Appeal to Prefecture                                                33
#>   Send Fine                                                                 0
#>   Send for Credit Collection                                                0
#>   Start                                                                     0
#>                                        consequent
#> antecedent                              Send Appeal to Prefecture Send Fine
#>   Add penalty                                                 171         0
#>   Appeal to Judge                                               0         0
#>   Create Fine                                                   0      6557
#>   End                                                           0         0
#>   Insert Date Appeal to Prefecture                             53         0
#>   Insert Fine Notification                                      0         0
#>   Notify Result Appeal to Offender                              0         0
#>   Payment                                                       0        13
#>   Receive Result Appeal from Prefecture                         0         0
#>   Send Appeal to Prefecture                                     0         0
#>   Send Fine                                                     0         0
#>   Send for Credit Collection                                    3         0
#>   Start                                                         0         0
#>                                        consequent
#> antecedent                              Send for Credit Collection Start
#>   Add penalty                                                 3288     0
#>   Appeal to Judge                                                0     0
#>   Create Fine                                                    0     0
#>   End                                                            0     0
#>   Insert Date Appeal to Prefecture                               0     0
#>   Insert Fine Notification                                       0     0
#>   Notify Result Appeal to Offender                              20     0
#>   Payment                                                       78     0
#>   Receive Result Appeal from Prefecture                          1     0
#>   Send Appeal to Prefecture                                      0     0
#>   Send Fine                                                      0     0
#>   Send for Credit Collection                                     0     0
#>   Start                                                          0     0