R Markdown with Shiny Server change host parameter

前端 未结 2 497
无人共我
无人共我 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:39

    Set the default values you want to initialize in (~/.Rprofile) under user directory

    Sys.setenv(TZ = "UTC")  # for Timezone
    options(shiny.port = 9999)
    
    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题