[R] Opening a script with the R editor via file association (on Windows)

Christopher Green cggreen at stat.washington.edu
Sat Aug 4 01:16:22 CEST 2007


Is there an easy way to open an R script file in the R Editor found in
more recent versions of R on Windows via a file association? I am looking
for functionality akin to how the ".ssc" file extension works for S-Plus:
upon double-clicking on a ".R" file, Rgui.exe starts up and loads the script 
file in the R Editor.

As far as I can tell, Rgui.exe does not have a command line option to load
a file (so associating ".R" with "Rgui.exe %1" won't work). I can get Windows
to start Rgui.exe when I double-click on a script file, but that's about it.
I also don't see any way to have Rgui.exe evaluate an expression provided on
the command line (which would allow "file.edit(%1)"). I also thought about
creating a custom .First calling 'file.edit' in a batch file, but then I'd have
to start R, load the .First file, then quit and restart R, so that's out.

Is there an easy way to do this without resorting to some other R GUI?

Thanks,

Chris Green

________________________________

Christopher G. Green (cggreen AT stat.washington.edu) 
Doctoral Candidate
Department of Statistics, Box 354322, Seattle, WA, 98195-4322, U.S.A.
http://www.stat.washington.edu/cggreen/



More information about the R-help mailing list