add_dataframe() function not designed to handle Shiny's reactive dataframe objects?

21 views
Skip to first unread message

Pranay Panta

unread,
Jan 13, 2023, 6:26:04 AM1/13/23
to simmer-devel
Hi Inaki, 

First of all thanks for such a great package, it has been immensly useful in the work that I do. 

I am currenty building a Shiny app with an integrated simmer model. I need to be able to add a functionality in the app where the user can upload a dataframe that acts as a preloaded queue. Within the shiny framework, the uploaded data becomes a reactive dataframe. It seems add_dataframe is unable to handle Shiny reactive dataframe objects. Or am I doing something wrong? 

I have been getting the desired results when I feed a locally saved dataframe into 'add_dataframe' but I have been getting an error message when I feed the same data through as a reactive dataframe uploaded within the app. 

For example,

 add_dataframe("Level A", trajectory1,finaldata,  col_time= "time", col_priority="priority", time = "absolute", col_attributes = c("service"))  ###This is okay 

add_dataframe("Level A", trajectory1,finaldata(),  col_time= "time", col_priority="priority", time = "absolute", col_attributes = c("service"))  ### This is not okay where finaldata() is a reactive dataframe. 

Am I doing something wrong? or is add_dataframe unable to handle Shiny reactive dataframe objects? 

It might make sense for me to go through the old ways  of add_generator to add a pre-loaded queue. It seems there are no issues to pass on reactive objects through other functions within Simmer. For example I can add finaldata()$variable as a valid object in other functions within simmer. 

I came across one of your previous responses in another thread attached below that discussed about pre-loading a queue via add_generator

https://stackoverflow.com/questions/44865924/using-simmer-to-build-a-specific-model


It seems the codes you provide in that thread for adding a dataframe through the add_generator route does not work? Can you please help me with that or am I making some silly mistake?

Have a nice day. 

Thanks,
Pranay 





Iñaki Ucar

unread,
Jan 13, 2023, 6:48:37 AM1/13/23
to simmer...@googlegroups.com
A dataframe that results from a reactive is just a dataframe, there should be no issue as long as it is properly constructed. What issue are you experiencing? Is there a minimal reproducible example that we could examine?

Iñaki

--
You received this message because you are subscribed to the Google Groups "simmer-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to simmer-devel...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/simmer-devel/d032a174-1fbe-490a-aa80-05814141c129n%40googlegroups.com.


--
Iñaki Úcar

Pranay Panta

unread,
Jan 15, 2023, 10:27:06 PM1/15/23
to simmer-devel
Hi  Iñaki,

Yes, it works for me now and there are no issues.

I accidentally called add_dataframe before the data was ready. Your answer helped me be more patient and look closer.

Thank you once again for such a great package and for supporting the community as well. 

Thanks,
Pranay 




Reply all
Reply to author
Forward
0 new messages