Skip to content

Dynamically modify a dataframe as a R simmer simulation runs? I need it for appointment scheduling simulation #300

Closed Answered by Enchufa2
Tricipy asked this question in Q&A
Discussion options

You must be logged in to vote

As you discovered here, you were executing the assign_appointment once when the trajectory was created. Instead, it needs to be enclosed in a parameterless function, so that it is executed each time an arrival reaches that point in the trajectory, in the same way you did with the patient_counter function. Therefore,

#Appointment assignment
set_attribute("appointment_time",function(){
              assign_appointment(p_id = get_attribute(clinic, "patient_id"),
                                 env_now = simmer::now(clinic),
                                 df = df_appointment_slots)}) %>% 

Please, next time, try to avoid crossposting. This generates unnecessary duplicity.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Enchufa2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants