library(simmer)
patient_traj <- trajectory(name = "patient_trajectory") %>%
set_attribute("resource", function() sample(1:3, 1)) %>%
select(resources = function(attrs) paste0("doctor", attrs["resource"])) %>%
seize_selected(amount = 1) %>%
timeout(5) %>%
release_selected(amount = 1)
env <- simmer() %>%
add_resource("doctor1", capacity = 1) %>%
add_resource("doctor2", capacity = 1) %>%
add_resource("doctor3", capacity = 1) %>%
add_generator("patient", patient_traj, at(0, 1, 2), mon = 2) %>%
run()
get_mon_attributes(env)
============================================================
produces the following error:
Error in UseMethod("select_") :
no applicable method for 'select_' applied to an object of class "c('trajectory', 'R6')"
Why is that? How does simmer know that this is not select() from package dplyr?