/
process_matrix.R
80 lines (56 loc) · 1.92 KB
/
process_matrix.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#' Create process matrix
#'
#' @param type A process matrix type, which can be created with the functions frequency, performance and custom. The first type focusses on the frequency aspect of a process, while the second one focussed on processing time. The third one allows custom attributes to be used.
#' @param ... Other arguments
#' @inheritParams dotted_chart
#' @export process_matrix
#'
process_matrix <- function(log, type , ..., eventlog = deprecated()) {
UseMethod("process_matrix")
}
#' @describeIn process_matrix Process matrix for event log
#' @export
process_matrix.eventlog <- function(log,
type = frequency(),
..., eventlog = deprecated()) {
if(lifecycle::is_present(eventlog)) {
lifecycle::deprecate_warn("0.4.0",
"process_matrix(eventlog)",
"process_matrix(log)")
log <- eventlog
}
node_id.y <- NULL
node_id.x <- NULL
sec_label <- NULL
ACTIVITY_CLASSIFIER_ <- NULL
CASE_CLASSIFIER_ <- NULL
TIMESTAMP_CLASSIFIER_ <- NULL
ACTIVITY_INSTANCE_CLASSIFIER_ <- NULL
start_time <- NULL
min_order <- NULL
end_time <- NULL
n.x <- NULL
n.y <- NULL
base_precedence <- create_base_precedence(log, type, type)
extra_data <- list()
extra_data$n_cases <- n_cases(log)
extra_data$n_activity_instances <- n_activity_instances(log)
edges <- attr(type, "create_edges")(base_precedence, type, extra_data) %>%
attr(type, "transform_for_matrix")(type, extra_data)
class(edges) <- c("process_matrix", class(edges))
attr(edges, "matrix_type") <- type
return(edges)
}
#' @describeIn process_matrix Process matrix for activity log
#' @export
process_matrix.activitylog <- function(log,
type = frequency(),
..., eventlog = deprecated()) {
if(lifecycle::is_present(eventlog)) {
lifecycle::deprecate_warn("0.4.0",
"process_matrix(eventlog)",
"process_matrix(log)")
log <- eventlog
}
log %>% bupaR::to_eventlog() %>% process_matrix(type)
}