possible to run RShiny app without opening an R environment?

后端 未结 7 1138
一个人的身影
一个人的身影 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:18

    RStudio != R

    There is a simple command-line interface to R, which you can run on Windows by running R.exe in the bin folder of your R installation.

    There's also Rscript.exe, which can run an expression or a script file. For example:

    C:\Program Files\R\R-2.15.2\bin\RScript -e hist(runif(1000))
    

    will (given the right paths) create a PDF file with a histogram in it.

    So,

    • your co-worker needs an R installation
    • you need that installation to have all the packages to run shiny
    • or you add a bunch of install.packages() lines to your code
    • you need to give them a folder with your shiny code
    • you add a windows .BAT file for them to click
    • they run that, it calls Rscript.exe which starts the shiny package you gave them

    Or get it hosted on the RStudio guys' public shiny server, but then we can all see it.

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