jgarcia at ija.csic.es
2010-Feb-12 16:22 UTC
[R] Selective load of .First() function just for Rgui.exe
Hi all, I have a .First <- function() {...} in the Rprofile.site file. Through .First() I'm adding several menus to the GUI to access several functions I've been developing for own use. However, I also need to launch R scripts silently in a batch way, and in this case I get the error message: "Error in winMenuAdd(menuname, NULL, NULL): Menu functions can only be used in the GUI" Do you know about about a way to selectively read the .First() function just for Rgui.exe, but not for call to R.exe? Thanks and best regards, Javier ---
Duncan Murdoch
2010-Feb-12 17:13 UTC
[R] Selective load of .First() function just for Rgui.exe
On 12/02/2010 11:22 AM, jgarcia at ija.csic.es wrote:> Hi all, > I have a .First <- function() {...} in the Rprofile.site file. Through > .First() I'm adding several menus to the GUI to access several functions > I've been developing for own use. > > However, I also need to launch R scripts silently in a batch way, and > in this case I get the error message: > > "Error in winMenuAdd(menuname, NULL, NULL): > Menu functions can only be used in the GUI" > > Do you know about about a way to selectively read the .First() > function just for Rgui.exe, but not for call to R.exe?The .Platform variable contains a list of things that identify the current platform. In Rterm (or R.exe) you'll have .Platform$GUI == "RTerm", whereas in Rgui, it will be "Rgui". Duncan Murdoch