Display HTML File in Shiny App

Display HTML file in Shiny App

If you want to include HTML content from another file in a layout, just use the includeHTML() function. For example

shinyUI(fluidPage(
titlePanel("Included Content"),
mainPanel(
includeHTML("include.html")
)
))

should be minimally sufficient to how the contents of "include.html" on a particular page. If you need to make it more dynamic, you can do

#  ----- ui.R -----

shinyUI(fluidPage(
titlePanel("Uploading Files"),
mainPanel(
htmlOutput("inc")
)
))

# ----- server.R -----

shinyServer(function(input, output) {
getPage<-function() {
return(includeHTML("include.html"))
}
output$inc<-renderUI({getPage()})
})

And you could use whatever logic you want to to specify the filename you want to load.

Shiny App that include HTML files doesnt render images when is running in command

I managed to fix it by running another script that runs the app.R

run.R

shiny :: runApp ('app.R')

In command:

"R.exe" CMD BATCH "run.R"

Trouble including a HTML file which contains a tippy elememt in a shiny app

Build the HTML document as a fragment. The tool tips will not work on the knitted HTML fragment, but when you include the built HTML file it in the Shiny app, you'll see the tool tips.

 ---
output: html_fragment
---

Output Pure HTML File From R Shiny App

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.



Related Topics



Leave a reply



Submit