I have a shiny app that opens in the browser when I provide the following code in the base R prompt:
shiny::runApp("C:/Myapp")
I use windows 7. I am trying to create a desktop icon to avoid my client typing the above code every time he wants to use the app. I have created a desktop icon and the set the path in "Target" as follows:
"C:\Program Files\R\R-3.2.2\bin\R.exe" -e "shiny::runApp("C:\Myapp")
and in the "start in" box I have included
"C:\Myapp"
The app is not opening. I have tried changing the \ to / in C:/Myapp - doesn't work. However, when I try the following:
"C:\Program Files\R\R-3.2.2\bin\R.exe" -e "shiny::runApp()
that is, without referring to my app folder, rhe R program runs, loads the code shiny::runApp()
and prints the message
Listening on http://127.0.0.1:4354
Can someone help on how to resolve this? I have tried various combinations of the above.
First, if your app folder is "C:\Documents\myApp", then your working directory should be "C:\Documents" (to insert in "start in" box).
Second, use ' ' for your inner quotes:
"C:\Program Files\R\R-3.2.2\bin\R.exe" -e "shiny::runApp('C:/Myapp')"
Third, consider launching your browser with your runApp command. Otherwise there might be nothing to see. (shiny::runApp('C:/Myapp', launch.browser = TRUE)
)
The following code saved as a '.bat' file worked for me on Windows 10 as suggested by RBloggers
start "" "C:\Program Files\R\R-4.0.3\bin\Rscript.exe" C:\RShiny\MyShinyApp\app.R /k
start "MyShinyApp" "http://127.0.0.1:4354/"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With