Reputation: 1070
From google am trying to understand "simmer" package in R for discrete event simulation.
As per the example given in the link, am trying to create the simulator using create_simulator function. but am getting the below error
Code Used:
trajectory <- read.table(header=T, text= "event_id description resource amount duration successor 1 registration administration 1 runif(1,3,10) 2 2 intake nurse 1 runif(1,10,20) 3 3 consultation doctor 1 runif(1,5,15) NA" )
sim <- create_simulator(name = "SuperDuperSim") %>% add_trajectory(name = "simple_trajectory", trajectory_df = trajectory) %>% add_resource(name = "administration", capacity = 1) %>% add_resource(name = "nurse", capacity = 1) %>% add_resource(name = "doctor", capacity = 2) %>% add_entities_with_interval(n = 10, name_prefix = "patient", trajectory_name = "simple_trajectory", interval = "rnorm(1,10)") %>% replicator(15)
Error:
Error in eval(expr, envir, enclos) :
could not find function "create_simulator"
Upvotes: 0
Views: 677
Reputation: 1495
I have never used this package before but it appears to me that the create_simulator
function does not exist in the current version of the package (the add_trajectory
function doesn't seem to exist too). Information about the simmer
package is available at https://github.com/r-simmer/simmer. More specifically, an introduction is given at: https://cran.r-project.org/web/packages/simmer/vignettes/A-introduction.html. It appears to me from this site that the creation of the simulator is now done by typing simmer(nameOfMySimulator)
.
Upvotes: 1