[This article was first published on rstats-tips.net, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
As I mentioned earlier I’ve built a shiny app to visualize the development of SARS-CoV-2 in Germany.
Running it locally works very well. But how to deploy an app in the web?
There is a free service at shinyapps.io where you can host your shiny app.
But the free plan offers only a fixed amount of memory. The data my app is reading consumes more memory than I get there. So I was looking for a way my app can detect whether it is running at shinyapps.io or not. Depending on the result of this check I can offer different features to the user (such as updating the data).
It turns out that there is an environment variable set at shinyapps.io:
1 |
Sys.getenv("R_CONFIG_ACTIVE") == "shinyapps" |
So depending on the value of R_CONFIG_ACTIVE
you can change the behaviour of your app.
To leave a comment for the author, please follow the link and comment on their blog: rstats-tips.net.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.