The alpha miner algorithm is provided through the pm4py package.

library(bupaR)
library(pm4py)
library(petrinetR)

It can be executed through the discovery_alpha function.

#use only complete timestamp
patients_completes <- patients %>% filter_lifecycle("complete")

discovery_alpha(patients_completes) -> PN

The resulting object consist of three elements, a net, an initial marking, and a final marking. The net can be visualized using petrinetR as follows.

PN %>% str
## List of 3
##  $ petrinet       :List of 4
##   ..$ places     :'data.frame':  7 obs. of  1 variable:
##   .. ..$ id: chr [1:7] "({Registration}, {Triage and Assessment})" "({Blood test}, {MRI SCAN})" "({MRI SCAN, X-Ray}, {Discuss Results})" "({Triage and Assessment}, {Blood test, X-Ray})" ...
##   ..$ transitions:'data.frame':  7 obs. of  2 variables:
##   .. ..$ id   : chr [1:7] "Blood test" "Triage and Assessment" "MRI SCAN" "Check-out" ...
##   .. ..$ label: chr [1:7] "Blood test" "Triage and Assessment" "MRI SCAN" "Check-out" ...
##   ..$ flows      :'data.frame':  14 obs. of  2 variables:
##   .. ..$ from: chr [1:14] "start" "({Triage and Assessment}, {Blood test, X-Ray})" "Check-out" "Registration" ...
##   .. ..$ to  : chr [1:14] "Registration" "Blood test" "end" "({Registration}, {Triage and Assessment})" ...
##   ..$ marking    : chr "start"
##   ..- attr(*, "class")= chr "petrinet"
##  $ initial_marking: chr "start"
##  $ final_marking  : chr "end"
PN$petrinet %>% render_PN()

Two different variants of the alpha miner can be used: classical and plus. These can be defined by giving the functions variant_alpha_classic and variant_alpha_plus to the argument variant of the discovery_alpha_function. The default is classic.

discovery_alpha(patients_completes, variant = variant_alpha_plus()) -> PN
PN$petrinet %>% render_PN()