KentonWhite / ProjectTemplate

A template utility for R projects that provides a skeletal project.
http://projecttemplate.net
GNU General Public License v3.0
623 stars 159 forks source link

compatibility with shiny #208

Closed benchoufi closed 7 years ago

benchoufi commented 7 years ago

hi,

Is project template format compatible with shiny app deployment ?

Best regards

KentonWhite commented 7 years ago

@benchoufi short answer is no. TL;DR is that Shiny uses reactives to load data when it is needed; ProjectTemplate loads data all at once.

I've tried wrapping ProjectTemplate in a reactive so that it can continuously refresh the data. This significantly slows Shiny down, since all of the data is being loaded at once. To make this truly work, the load and munge steps should be rewritten as reactives.

I've also tried using ProjectTemplate to load the data as part of initialization. The challenge here is that if your Shiny site sleeps, when it wakes it will go through the ProjectTemplate process, again significantly slowing your Shiny site down.

I would love to have a ProjectTemplate-like ETL framework that played nice with Shiny. Currently ProjectTemplate is far down its own path that I think it would be easier to start from the ground up with an ETL framework built around reactives. If you want to help with such a project please let me know!

benchoufi commented 7 years ago

thank you @KentonWhite for your complete response. I would be delighted to contribute, coming from the java world, I am not that much skilled in R. Indeed, ETL framework working with shiny would be a very nice project ;)

Regards, Mehdi