'Running R Shiny App within RStudio versus a Batch file or Command Prompt
I created a Shiny Dashboard App within RStudio and when I run the dashboard, within RStudio, I have no problems -- the dashboard pops up as expected.
I created a shortcut to run the app using a batch file, I simply followed this example. When I execute the batch file, a browser pops up and loads the dashboards but the browser is grayed out and the data is not populated in the dashboard.
My batch file code: "C:\Program Files\R\R-4.0.4\bin\R.exe" CMD BATCH "run.r"
which executes the run.r file that subsequetly runs a ui.r and server.r file. The run.r script is as follows:
require(shiny)
folder_address = 'C://test_app'
runApp(folder_address, launch.browser=TRUE) `
I tried a different method to create a shortcut, which was simply creating a command prompt script which when executed immediately errors out and says:
Package 'htmltools' version 0.5.1.1 cannot be unloaded: Error in unloadNamespace(package) : namespace 'htmltools' is imported by 'rmarkdown', 'shinydashboard', 'flexdashboard', 'shiny' so cannot be unloaded
I figured I could solve the htmltools issue by reinstalling each package mentioned in the error but that just that didn't work and the error returned.
My command prompt script:
C:\Program Files\R\R-40~1.4\bin\Rscript.exe" -e "shiny::runApp('C:/test_app', launch.browser = TRUE)"
The issue doesnt seem to be with my actual r code but rather my batch file/ command prompt script or how the command is communicating with R. If anyone has any thoughts/suggestions I'd really appreciate the help.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
