Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Output Pure HTML File From R Shiny App

Tags:

html

r

shiny

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?

like image 395
John Avatar asked Oct 04 '17 22:10

John


1 Answers

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.

like image 188
Gregor de Cillia Avatar answered Sep 23 '22 19:09

Gregor de Cillia