Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a desktop icon for Shiny App

Tags:

r

desktop

shiny

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.

like image 840
LeArNr Avatar asked Feb 11 '16 13:02

LeArNr


2 Answers

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))

like image 193
K. Rohde Avatar answered Oct 20 '22 23:10

K. Rohde


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/"
like image 43
RanonKahn Avatar answered Oct 20 '22 23:10

RanonKahn