You can use act_unite()
to remove unwanted differences
between activities. For example, consider activities from the
sepsis
data set.
%>%
sepsis activities()
## # A tibble: 16 × 3
## activity absolute_frequency relative_frequency
## <fct> <int> <dbl>
## 1 Leucocytes 3383 0.222
## 2 CRP 3262 0.214
## 3 LacticAcid 1466 0.0964
## 4 Admission NC 1182 0.0777
## 5 ER Triage 1053 0.0692
## 6 ER Registration 1050 0.0690
## 7 ER Sepsis Triage 1049 0.0689
## 8 IV Antibiotics 823 0.0541
## 9 IV Liquid 753 0.0495
## 10 Release A 671 0.0441
## 11 Return ER 294 0.0193
## 12 Admission IC 117 0.00769
## 13 Release B 56 0.00368
## 14 Release C 25 0.00164
## 15 Release D 24 0.00158
## 16 Release E 6 0.000394
We can replace all Release X activities with a single unique Release activity.
%>%
sepsis act_unite(Release = c("Release A","Release B","Release C","Release D","Release E")) %>%
activities()
## # A tibble: 12 × 3
## activity absolute_frequency relative_frequency
## <fct> <int> <dbl>
## 1 Leucocytes 3383 0.222
## 2 CRP 3262 0.214
## 3 LacticAcid 1466 0.0964
## 4 Admission NC 1182 0.0777
## 5 ER Triage 1053 0.0692
## 6 ER Registration 1050 0.0690
## 7 ER Sepsis Triage 1049 0.0689
## 8 IV Antibiotics 823 0.0541
## 9 Release 782 0.0514
## 10 IV Liquid 753 0.0495
## 11 Return ER 294 0.0193
## 12 Admission IC 117 0.00769
Note that, in contrast with act_collapse()
, the number
of activity instances will never be changed by act_unite()
.
Only the labels of existing activity instances will be changed. On the
other hand act_collapse()
merges multiple activity
instances into a new instance.
Read more:
Copyright © 2023 bupaR - Hasselt University