forked from bupaverse/processmapR
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresource_map.R
37 lines (28 loc) · 1.2 KB
/
resource_map.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#' @title Resource Map
#'
#'
#' @description A function for creating a resource map of an event log based on handover of work.
#' @param eventlog The event log object for which to create a resource map
#' @param type A process map type, which can be created with the functions frequency and performance. The first type focusses on the frequency aspect of a process, while the second one focussed on processing time.
#' @param render Whether the map should be rendered immediately (default), or rather an object of type dgr_graph should be returned.
#' @param ... Deprecated arguments
#'
#' @examples
#' \dontrun{
#' library(eventdataR)
#' data(patients)
#' resource_map(patients)
#' }
#' @export resource_map
resource_map <- function(eventlog, type = frequency("absolute"), render = T, ...) {
event_classifier <- activity_id(eventlog)
resource_classifier <- resource_id(eventlog)
n <- eventlog %>%
names %>%
str_replace_all(paste0("^",event_classifier, "$"), "old_event_classifier") %>%
str_replace_all(paste0("^",resource_classifier, "$"), event_classifier) %>%
str_replace_all("old_event_classifier",resource_classifier)
eventlog %>%
set_names(n) %>%
process_map(render = render, type = type, ...)
}