Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running an R script using a Windows shortcut

Tags:

r

I am trying to create an icon on my desktop (Windows OS). By clicking on this icon, an R script will be executed, which launches a GUI application (gWidgets).

like image 846
SilverSpoon Avatar asked Apr 25 '12 08:04

SilverSpoon


People also ask

Can I run R in CMD?

Running R from the Command Line To open up the command prompt, just press the windows key and search for cmd. When R is installed, it comes with a utility called Rscript. This allows you to run R commands from the command line.


1 Answers

Read the help file ?Startup for details on what R goes through in the startup process and how you can automate running code.

I have done things like this for clients where I create a GUI for a specific demonstration (I use tcltk, but all should work the same). I created a desktop shortcut for them and modified the shortcut to start in a specific folder (but run the standard Rgui program), then in that folder I save a .Rdata file with all the code and data that the demo needs along with a function named .First that starts the demo.

Then the client does not need to know anything about R, just double click the shortcut and R starts and my demo starts automatically for them, they enter some numbers, click some options, slide some sliders, etc. and click on "OK" to see a graph or other output customized to their situation.

like image 181
Greg Snow Avatar answered Nov 15 '22 19:11

Greg Snow