R Markdown with Shiny Server change host parameter

前端 未结 2 510
无人共我
无人共我 2020-12-30 14:31

I am running RStudio on a server and I created a RMarkdown (.Rmd) file. It works fine if I create it as a static HTML but it does not work if I want it to be interactive (by

2条回答
  •  滥情空心
    2020-12-30 14:40

    The ::run command from rmarkdown invokes shiny::runApp internally. You can set the option shiny.host before running the document:

    options(shiny.host="0.0.0.0")
    rmarkdown::run("myfile.Rmd")
    

    You an also pass arbitrary paramters to runApp, so this should work too:

    rmarkdown::run("myfile.Rmd", shiny_args=list(host="0.0.0.0"))
    

    Neither of these will work with the Run Document button; that button starts a new R session in which to render the document. To change the shiny.host option in that session, you'll need to add the option to your .Rprofile.

提交回复
热议问题