possible to run RShiny app without opening an R environment?

后端 未结 7 1137
一个人的身影
一个人的身影 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)

    0 讨论(0)
  • I know this is a really old discussion but I have recently faced this issue and after trying a few options I found that using shinyshortcut package is the best :

    library(shinyShortcut) shinyShortcut(shinyDirectory = getwd(), OS = .Platform$OS.type, gitIgnore = FALSE)
    
    0 讨论(0)
  • 2021-01-30 06:01

    There's now a new way to use to build a truly stand-alone Shiny app exe via "Electron" and "Photon". See following links for packages/plug-ins, etc.

    • https://www.user2019.fr/static/pres/lt257916.pdf
    • https://www.youtube.com/watch?v=ARrbbviGvjc
    • Deploying R shiny app as a standalone application

    That said, RStudio's shinyapps.io or a Binder deployment is likely a better choice in accessibility and development.

    0 讨论(0)
  • 2021-01-30 06:07

    I know this is an old discussion, but it might help someone knowing this can be done now. You can create a standalone shiny app, that runs on computers WITHOUT needing to install R nor any library. There is a relatively simple way of doing it (currently I've done it only for Windows users, but something for MacOS should be around too), following these detailed steps: http://www.r-bloggers.com/deploying-desktop-apps-with-r/ .Other option could be uploading the app on the Shiny server.

    0 讨论(0)
  • 2021-01-30 06:07

    You can now use the RInno package for this type of thing. To get setup:

    install.packages("RInno")
    require(RInno)
    RInno::install_inno()
    

    Then you just need to call two functions to setup an installation framework:

    create_app(app_name = "myapp", app_dir = "path/to/myapp")
    compile_iss()
    

    If you would like to include R, add include_R = TRUE to create_app:

    create_app(app_name = "myapp", app_dir = "path/to/myapp", include_R = TRUE)
    

    It defaults to include shiny, magrittr and jsonlite, so if you are using other packages like ggplot2 or plotly, just add them to the pkgs argument. You can also include GitHub packages to the remotes argument:

    create_app(
        app_name = "myapp", 
        app_dir  = "path/to/myapp"
        pkgs     = c("shiny", "jsonlite", "magrittr", "plotly", "ggplot2"),
        remotes  = c("talgalili/installr", "daattali/shinyjs"))
    

    If you are interested in other features, check out FI Labs - RInno

    0 讨论(0)
  • 2021-01-30 06:12

    Below is a quick fix. go to the project directory in command line by cd. then

     R -e "shiny::runApp(port=8000,host = getOption('shiny.host', '10.10.10.10'))"
    

    now the URL 10.10.10.10:8000 will be active.

    To keep the URL alive even after you log off, nohup can be used. Obviously, not the desired setup for a production environment.

     nohup R -e "shiny::runApp(port=8000,host = getOption('shiny.host', '10.10.10.10'))" &
    
    0 讨论(0)
提交回复
热议问题