possible to run RShiny app without opening an R environment?

后端 未结 7 1151
一个人的身影
一个人的身影 2021-01-30 05:45

Currently I have a R shiny app, to run it I open up RStudio and execute

setwd(\"C:/Users/Me/Desktop/R/ShinyProject2\")
library(shiny)
......
runApp()
         


        
7条回答
  •  南笙
    南笙 (楼主)
    2021-01-30 06:01

    I faced the same problem and used the two following solutions that both worked fine.

    Publish the app on shinyapps.io

    Advantage: the app is accessible anytime from anywhere.

    Drawback: only 25 active hours per month.

    Method:

    1. Go to https://www.shinyapps.io/ and create a free account
    2. Configure rsconnect to link R with your new shinyapps account (step by step explanations in the shinyapps documentation)
    3. In Rstudio, click "publish" (next to run app button)
    4. Get the app address from the shinyapps.io dashboard and send it to your co-workers.

    Share app on LAN

    Advantage: as much active hours as you need.

    Drawbacks: requires being on the same local network (or use a VPN). The app must be running constantly on a computer connected to this network. Furthermore, it cannot perform computation for more than one user at a time.

    Method: You need to run the app on your computer and share it on the LAN by changing the runapp command to:

    runApp(host="0.0.0.0",port=5050)
    

    Then the app is accessible on http://[your-IP-address]:5050 (see this: Hosting LAN Shiny apps run from command line)

提交回复
热议问题