Creating a Shortcut for a Shiny App

2,842 views
Skip to first unread message

Ryan Grannell

unread,
Dec 11, 2012, 4:04:01 PM12/11/12
to shiny-...@googlegroups.com
Hello,

Does anyone know how to create a shortcut that, when clicked, runs a shiny app? Something that works like > runApp('directory name'), without you having to type into a console. I've tried using the following batch script, but it didn't open the app for me.

"C:\Program Files\R\R-2.15.1\bin\R.exe" CMD BATCH "run.r",

where run.r contains a call to runApp(....). Any thoughts?
Message has been deleted

Ryan Grannell

unread,
Dec 11, 2012, 4:26:55 PM12/11/12
to shiny-...@googlegroups.com
Nevermind, problem resolved. The run.r file needed to contain the argument launch.browser=TRUE, since I wasn't targeting the interactive R executable

Joe Cheng

unread,
Dec 11, 2012, 4:34:12 PM12/11/12
to shiny-...@googlegroups.com
Or just

"C:\Program Files\R\R-2.15.1\bin\R.exe" -e "shiny::runApp()"

and set the working directory of the shortcut to your Shiny app directory. Oh, you might want to add a unique "port" argument to the runApp call for each shortcut, so they don't conflict.


On Tue, Dec 11, 2012 at 1:26 PM, Ryan Grannell <r.gra...@gmail.com> wrote:
Nevermind, problem resolved. The run.r file needed to contain the argument launch.browser=TRUE, since I wasn't targeting the interactive R executable

--
 
 

Ryan Grannell

unread,
Dec 11, 2012, 5:07:56 PM12/11/12
to shiny-...@googlegroups.com
Thanks for the tip :)

Vincent Nijs

unread,
Oct 26, 2013, 2:20:44 AM10/26/13
to shiny-...@googlegroups.com
This works great in windows (see command below). I tried to do the same thing for Mac with the following command:

Rscript --no-save --no-restore -e "shiny::runApp('Desktop/radyant/', launch.browser=TRUE)"

However that gives the following error:

Loading required package: shiny
Error in ReactiveValues$new : could not find function "loadMethod"
Calls: <Anonymous> ... reactiveValues -> .createReactiveValues -> structure -> $
Execution halted

I also tried:

R --vanilla < Desktop/radyant/init.R

where init.R has the shiny::runApp command. This works fine from a terminal but, strangely, in an automator .app will start the app in a browser but not show data and only a few ui-elements

Content of windows .bat file for windows (which works well): 

"C:\Program Files\R\R-3.0.2\bin\R.exe" -e "shiny::runApp('~/../Desktop/radyant/', launch.browser=TRUE)"

Winston Chang

unread,
Oct 26, 2013, 12:43:10 PM10/26/13
to Vincent Nijs, shiny-...@googlegroups.com
I think this has something to do with the methods package not being loaded properly. Can you see if this works:
  Rscript --no-save --no-restore -e "library(methods); shiny::runApp('Desktop/radyant/', launch.browser=TRUE)"

This is something that should be easily fixable in Shiny.

-Winston



--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Vincent Nijs

unread,
Oct 26, 2013, 1:37:03 PM10/26/13
to shiny-...@googlegroups.com, Vincent Nijs
Thanks Winston!

The Rscript command works from the terminal now. However, when run from an automator workflow I, again, it is not showing the data. Since the data is in a reactive value I think the same issue might still be happening but I cannot see any error messages.

Images of what the app looks like when the command is run from from the terminal vs from a workflow are attached.
from_terminal.png
from_workflow.png

Vincent Nijs

unread,
Oct 26, 2013, 3:16:20 PM10/26/13
to shiny-...@googlegroups.com, Vincent Nijs
Putting the following in a workflow or app works so I am all set: 

tell application "R"
activate
cmd "setwd('~/Desktop/radyant/')"
cmd "shiny::runApp()"
end tell

Thanks Winston

Reply all
Reply to author
Forward
0 new messages