generate_nodes: Generate nodes from event logs

Description Usage Arguments Value Examples

View source: R/generate_nodes.R

Description

eventlog should be a data.frame, which contains, at least, following columns:

generate_nodes() will generate the node list from the given eventlog for the graph purpose.

Usage

1
generate_nodes(eventlog, distinct_case = FALSE)

Arguments

eventlog

Event logs

distinct_case

Whether should only count unique case

Value

a nodes data.frame which represents a event log, it contains name, category and amount columns.

Examples

 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
# -----------------------------------------------------
# Generate nodes from eventlog and count every event
# -----------------------------------------------------
eventlog <- generate_eventlog(10000, 100)
nodes <- generate_nodes(eventlog)
print(nodes)
# # A tibble: 10 x 3
#    name              category   amount
#    <chr>             <chr>   <int>
#  1 Activity 1 (normal)  normal    958
#  2 Activity 10 (target) target    948
#  3 Activity 2 (normal)  normal   1011
#  4 Activity 3 (normal)  normal   1030
#  5 Activity 4 (normal)  normal   1072
#  6 Activity 5 (normal)  normal    968
#  7 Activity 6 (normal)  normal   1020
#  8 Activity 7 (normal)  normal    978
#  9 Activity 8 (normal)  normal   1003
# 10 Activity 9 (target)  target   1012
#
# -----------------------------------------------------
# Generate nodes and only count by unique case.
# -----------------------------------------------------
#
nodes <- generate_nodes(eventlog, distinct_case = TRUE)
nodes
# # A tibble: 10 x 3
#    name              category   amount
#    <chr>             <chr>   <int>
#  1 Activity 1 (normal)  normal    100
#  2 Activity 10 (target) target    100
#  3 Activity 2 (normal)  normal    100
#  4 Activity 3 (normal)  normal    100
#  5 Activity 4 (normal)  normal    100
#  6 Activity 5 (normal)  normal    100
#  7 Activity 6 (normal)  normal    100
#  8 Activity 7 (normal)  normal    100
#  9 Activity 8 (normal)  normal    100
# 10 Activity 9 (target)  target    100

twang2218/pmap documentation built on Nov. 3, 2021, 11:25 p.m.