The `absent` rule can be used to check whether an activity is absent in a case or not. The `n` parameter can be configured to create a different level of _absence_. When n = 1, an activity is not allowed to occur even a single time. The maximum number of times it is allowed to occur is `n-1`.

absent(activity, n = 0)

Arguments

activity

The activity to check. Character vector of length one.

n

n is the allowed number of occurences of the activity. E.g. n = 0 means the activity should be absent, n = 1 means it is allowed to occur once.

See also

Examples

library(bupaR)
#> Loading required package: edeaR
#> Loading required package: eventdataR
#> Loading required package: processmapR
#> Loading required package: xesreadR
#> Loading required package: processmonitR
#> Loading required package: petrinetR
#> #> Attaching package: 'bupaR'
#> The following object is masked from 'package:stats': #> #> filter
#> The following object is masked from 'package:utils': #> #> timestamp
library(eventdataR) # Check for which patients the activity "MRI SCAN" is absent. patients %>% check_rule(absent("MRI SCAN"))
#> Log of 5442 events consisting of: #> 7 traces #> 500 cases #> 2721 instances of 7 activities #> 7 resources #> Events occurred from 2017-01-02 11:41:53 until 2018-05-05 07:16:02 #> #> Variables were mapped as follows: #> Case identifier: patient #> Activity identifier: handling #> Resource identifier: employee #> Activity instance identifier: handling_id #> Timestamp: time #> Lifecycle transition: registration_type #> #> # A tibble: 5,442 x 8 #> handling patient employee handling_id registration_ty~ time #> <fct> <chr> <fct> <chr> <fct> <dttm> #> 1 Registr~ 1 r1 1 start 2017-01-02 11:41:53 #> 2 Registr~ 2 r1 2 start 2017-01-02 11:41:53 #> 3 Registr~ 3 r1 3 start 2017-01-04 01:34:05 #> 4 Registr~ 4 r1 4 start 2017-01-04 01:34:04 #> 5 Registr~ 5 r1 5 start 2017-01-04 16:07:47 #> 6 Registr~ 6 r1 6 start 2017-01-04 16:07:47 #> 7 Registr~ 7 r1 7 start 2017-01-05 04:56:11 #> 8 Registr~ 8 r1 8 start 2017-01-05 04:56:11 #> 9 Registr~ 9 r1 9 start 2017-01-06 05:58:54 #> 10 Registr~ 10 r1 10 start 2017-01-06 05:58:54 #> # ... with 5,432 more rows, and 2 more variables: .order <int>, #> # absent_MRI_SCAN_0 <lgl>
# Check for which patients the activity "Blood test" # occurs maximum a single time, but not 2 times or more. patients %>% check_rule(absent("Blood test", n = 1))
#> Log of 5442 events consisting of: #> 7 traces #> 500 cases #> 2721 instances of 7 activities #> 7 resources #> Events occurred from 2017-01-02 11:41:53 until 2018-05-05 07:16:02 #> #> Variables were mapped as follows: #> Case identifier: patient #> Activity identifier: handling #> Resource identifier: employee #> Activity instance identifier: handling_id #> Timestamp: time #> Lifecycle transition: registration_type #> #> # A tibble: 5,442 x 8 #> handling patient employee handling_id registration_ty~ time #> <fct> <chr> <fct> <chr> <fct> <dttm> #> 1 Registr~ 1 r1 1 start 2017-01-02 11:41:53 #> 2 Registr~ 2 r1 2 start 2017-01-02 11:41:53 #> 3 Registr~ 3 r1 3 start 2017-01-04 01:34:05 #> 4 Registr~ 4 r1 4 start 2017-01-04 01:34:04 #> 5 Registr~ 5 r1 5 start 2017-01-04 16:07:47 #> 6 Registr~ 6 r1 6 start 2017-01-04 16:07:47 #> 7 Registr~ 7 r1 7 start 2017-01-05 04:56:11 #> 8 Registr~ 8 r1 8 start 2017-01-05 04:56:11 #> 9 Registr~ 9 r1 9 start 2017-01-06 05:58:54 #> 10 Registr~ 10 r1 10 start 2017-01-06 05:58:54 #> # ... with 5,432 more rows, and 2 more variables: .order <int>, #> # absent_Blood_test_1 <lgl>