Running R script using windows shortcut

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

+8
source share
4 answers

Read the help file? Startup to get information that R goes through the start-up process and how you can automate the code that is executed.

I did things for clients where I create a GUI for a specific demo (I use tcltk, but everything should work the same way). I created a desktop shortcut for them and changed the shortcut for launching in a specific folder (but I launched the standard Rgui program), and then in this folder I saved a .Rdata file with all the code and data that the demo and the named function need. The demonstration starts first.

Then the client does not need to know anything about R, just double-click the shortcut and R will start and my demo will start automatically for them, they enter some numbers, select some parameters, shift some sliders, etc. and click on "OK" to see a graph or other result configured for their situation.

+4
source

I think you're looking for a batch file to run a file?

if you need to check this comment shows how to do this on the command line, turn it into a batch file.

https://stat.ethz.ch/pipermail/r-help/2002-March/019950.html

+2
source

Have you tried using the RScript command? I don't know how this works on Windows, but on Linux I would do something like:

 Rscript --vanilla -e 'source("abc.R")' 
+2
source

The basic version of this that I did on Windows 7:

  1. find the RScript.exe file (for example, C: \ Users \ USERNAME \ Documents \ R \ R-3.3.2 \ bin \ x64 \ RScript.exe)
  2. right-click and select Pin to Taskbar

The R icon should appear on the taskbar at the bottom of the screen.

  1. find your script (e.g. C: \ Users \ USERNAME \ Documents \ MyScript.R) and drag it onto the R icon in the taskbar
  2. right-click on the icon, "MyScript" should be docked there.
  3. click "MyScript" to run the script.
0
source

All Articles