It is possible to use a secondary data frame to determine the aesthetics of tokens irregardless of the times at which activities occurred. This can be useful if measurement are taken throughout a process, but the measurement event itself should not be included in the process map.
For example, the lactic acid measurements of the sepsis
data could be used in that way:
library(processanimateR)
library(dplyr)
library(bupaR)
# Extract only the lacticacid measurements
<- sepsis %>%
lactic mutate(lacticacid = as.numeric(lacticacid)) %>%
filter_activity(c("LacticAcid")) %>%
as.data.frame() %>%
select("case" = case_id,
"time" = timestamp,
value = lacticacid) # format needs to be 'case,time,value'
# Remove the measurement events from the sepsis log
<- sepsis %>%
sepsisBase filter_activity(c("LacticAcid", "CRP", "Leucocytes", "Return ER",
"IV Liquid", "IV Antibiotics"), reverse = T) %>%
filter_trace_frequency(percentage = 0.95)
# Animate with the secondary data frame `lactic`
animate_process(sepsisBase,
mode = "relative",
duration = 300,
legend = "color",
mapping = token_aes(color = token_scale(lactic,
scale = "linear",
range = c("#fff5eb","#7f2704"))))