I am currently trying to use bupaR to generate some R visuals in power BI for process mining. Currently I have a dataset with over 120k rows. There are not rows with empty timestamps. The code I am using is the following:
library(bupaR)
library(DiagrammeR)
GeneralData <- dataset
GeneralData$LASTUPDATE <- as.POSIXct(GeneralData$LASTUPDATE, tz = "GMT", format = c("%d-%m-$Y %H:%M:%S"))
x <- GeneralData %>%
eventlog(
activity_id = "STATUS",
case_id = "CONTRACTID",
resource_id = "CAT",
activity_instance_id = "Index",
lifecycle_id = "CTYPE",
timestamp = "LASTUPDATE"
) %>% process_map(performance(median, "days"), render=FALSE)
export_graph(x, "result.png", file_type = "png")
Whenever I try to run this, I receive the following message:
Error in data.frame(id = 1:n, type = type, label = label, stringsAsFactors = FALSE) : Arguments imply different number of rows: 2, 0 Calls: %>% ... create_node_df -> -> list2 -> data.frame.
How can I solve this? if I don't try to measure the amount of time used for each step of the process, the code works fine:
library(bupaR)
library(DiagrammeR)
Query1 <- dataset
Query1$LASTUPDATE <- as.POSIXct(Query1$LASTUPDATE, tz="GMT", format = c("%Y-%m-$d %H:%M:%S"))
x <- Query1 %>%
eventlog(
activity_id="STATUS",
case_id="CONTRACTID",
resource_id="CAT",
activity_instance_id= "Index",
lifecycle_id="CTYPE",
timestamp="LASTUPDATE"
)
y <- process_map(x, render=FALSE)
export_graph(y, "result.png", file_type = "png")
I can't figure out why this isn't working.