Run Shiny App from Shortcut Windows 10

后端 未结 2 1585
野趣味
野趣味 2021-02-09 15:26

I\'m trying to create a shortcut on the desktop to run a Shiny app. I am stuck on creating a batch file to execute this and after scouring the web, I still haven\'t been able to

相关标签:
2条回答
  • 2021-02-09 15:48

    Probably you have solved it, but for someone who has the same question, I'm posting what worked for me. I created a .bat file like this:

    "path/to/R.exe" -e "shiny::runApp('path/to/shinyAppFolder', launch.browser = TRUE)"
    

    But I think this works as well:

    "path/to/R.exe" -e "path/to/run.R"
    

    You can always add a line with the pause command to your batch file so you can see whats going wrong with the script

    Hope this helps

    0 讨论(0)
  • 2021-02-09 16:03

    You have to set the R working directory to the folder containing your shiny files; or explicitly specify the path in your call to runApp().

    Something like this:

    test.bat

    "path/to/Rscript.exe" "path/to/run.R"
    

    run.R

    library(shiny)
    setwd("c:/users/username/Desktop/test")
    runApp()
    
    0 讨论(0)
提交回复
热议问题