The solution proposed by Spacedman worked for me. In the following, I'd like to give some practical examples on how to.
Step 1.
Assuming that your coworkers don't know R and RStudio, they still needs R installed on their PC. They don't necessarily need RStudio.
Step 2.
They need shiny library all the libraries in your shiny app installed. But suppose they don't know how to install them.
They have to run the following R code once (with some example libraries):
# collect here all the libraries used by your shiny app
install.packages(c('shiny', 'ggplot2', 'magrittr'), repos='http://cran.us.r-project.org')
If they don't have privileges to install or they want to install these additional libraries somewhere else, then specify where they have to be installed:
install.packages(c('shiny', 'ggplot2', 'magrittr'), 'E:/some_path/rlib', repos='http://cran.us.r-project.org')
Being very lazy, without using R at all they can call a batch file. You can embed this R lines into a code named "installer.R" and call it from a batch file named "installer.bat" containing the following:
set RSCRIPT=C:\Programme\R\R-4.1.0\bin\Rscript.exe
set SPATH=C:\Documents\R_codes
call "%RSCRIPT%" "%SPATH%\installer.R"
This is assuming that their current version is R-4.1.0 and the variable SPATH
specifies the location of "installer.R"
Now, we are (almost) ready to start shiny.
Step 3.
Normally, when you run your shiny app from R-Studio you include the command library(shiny)
in your shiny code and click the icon button "Run App" in R-Studio. But without R-Studio you have to load shiny and then run the app with command lines. For me it worked by using two R codes.
The first, let's call it "loader.R" containing:
library(shiny)
runApp('E:/path_to_your_app/myApp.R', launch.browser=TRUE)
And the second is your app "myApp.R":
library(shiny) # you can uncomment this because already in loader.R but leaving it does not harm
ui <- ...
server <- ...
shinyApp(ui = ui, server = server)
The option launch.browser=TRUE
will open the app in a browser. By default, shiny runs with the option "window" inside R-Studio, which without R-Studio won't work.
Suppose that you have installed the necessary libraries in the path E:/some_path/rlib. Then, you have to specify it in the loader.R code with .libPaths
:
.libPaths("E:/some_path/rlib")
library(shiny)
runApp('E:/path_to_your_app/myApp.R', launch.browser=TRUE)
Step 4.
Create a batch file called say "call_siny_app.bat" to call your shiny app. This will contain:
set RSCRIPT=C:\Programme\R\R-4.1.0\bin\Rscript.exe
set SPATH=E:\path_to_your_app
call "%RSCRIPT%" "%SPATH%\loader.R"
The code calls "loader.R" (SPATH
has to specify the correct path) which then calls "myApp.R".
You do the steps from 1 to 4 and your coworkers only have to run call_siny_app.bat.