7
votes

I am looking to deploy my R Shiny App, however I cannot use the standard approach using runapp command and setting the IP to 0.0.0.0. I was wondering if there is any way I can output a pure HTML file that would include both the ui.R as well as the server.R functionality so I can deploy with a pure HTML file that's generated on a daily basis. Is it possible for R/Shiny to produce an index.html file that would include both the ui elements as well as emulate the server.R functionality/reactivity?

1
Short answer, no. If you want to deploy an interactive Shiny application, you need to either deploy a shiny-server or use shinyapps.ioKevin Arseneau
I would add however, you can embed Shiny functionality into documents, such as rmarkdown. This may suit your needs.Kevin Arseneau
I appreciate the reply. Would I be able to use rmarkdown to reference an R Shiny application to output a Rmarkdown file that's pure HTML? What I am getting at is essentially I can run the app on my local machine, but to deploy it to a larger audience I would most likely need a single file that's HTML since where I'm deploying wouldn't have R installed.John
it really depends what the app does. You need to pick the right tool for the job, I use shiny-server on premises and it is a simple thing. R Notebooks are self contained html with the R code embedded for reproducibility. They can be opened and edited as .Rmd files easily if you use the RStudio IDE. However, they will become very large very quickly after embedding data and any other assets to support it.Kevin Arseneau

1 Answers

11
votes

Basically, @Kevin Arschenau already pointed out the most impportant points in his comments.

You need an R server in order to execute a shiny app. There is no way to convert it into "pure HTML" and run the interactivity via javascript. The reason for that is that shiny apps will have to execute R code at runtime and javascript does not know how to deal with that.

If the site you want to deploy to does not have a working installation of R (and shiny-server), the only way to display a shiny app there is hosting the app on a different server and embedding it (via an iframe). For example, you can upload an app on shinyapps.io and include it in your webpage as demonstrated here.

If your company does not allow you to host the app on third-party sites (for disclosure reasons), you will have to consult the IT department and ask them to

  • install R and shiny-server on your company's server or
  • give you a VM or docker container so you can install the dependencies there

In case of docker, there are certain projects that facilitate this process. For example, shinyproxy makes it easy to create scalable apps with LDAP authentication.

If shiny-server is used directly by your company, note that there are user-limits in the free version.