[R] windows vs. linux code

(Ted Harding) Ted.Harding at manchester.ac.uk
Thu Feb 26 04:58:38 CET 2009


There is one MAJOR issue you will have to watch out for, far more
likely to turn up than calls like system().

This is that, if you want to have two or more plotting windows
in use at the same time, while the first one is autoatically
opened by the plot() command, you will have to open additional
ones explcitily.

In Linux, the command is X11() [possibly with paramaters, though
usually you don't need to bother].

In Windows, it is windows() [ditto].

I run R on Linux, so use the X11() command. However, If I write
a script which would also be run on a Windows system, I write
using windows() in the first instance, but with a conditional
"alias" to X11():

 if(length(grep("linux",R.Version()$os))){
  windows <- function( ... ) X11( ... )
}

and put this at the beginning of the code file. Then, if the code
is run on a Windows machine, the function call windows() does the
Windows thing; but if the code is run on Linux then the above test
detects that, and defines a function windows() which does the same
as X11().

Ted.

On 26-Feb-09 01:25:36, Sherri Heck wrote:
> i am asking if, in general, r code can be written on a linux-based 
> system and then run on a windows-based system. 
> 
> Rolf Turner wrote:
>>
>> On 26/02/2009, at 2:08 PM, Sherri Heck wrote:
>>
>>> Dear All-
>>>
>>> I have been given some Rcode that was written using a Linux OS, but I
>>> use Windows-based R.  The person that is giving it to me said that it
>>> needs to run on a Linux system.  Does anyone have any insight and/or
>>> can
>>> verify this.  I haven't yet obtained the code, so I haven't been able
>>> to
>>> try it yet.
>>
>> Despite the knowledge, wisdom, insight, skill, good looks, and other
>> admirable characteristics of the members of the R-help list, few of
>> us are skilled in telepathy or clairvoyance.
>>
>>     cheers,
>>
>>         Rolf Turner
>>
>> ######################################################################
>> Attention:This e-mail message is privileged and confidential. If you 
>> are not theintended recipient please delete the message and notify the
>> sender.Any views or opinions presented are solely those of the author.
>>
>> This e-mail has been scanned and cleared by 
>> MailMarshalwww.marshalsoftware.com
>> ######################################################################
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 26-Feb-09                                       Time: 03:58:35
------------------------------ XFMail ------------------------------




More information about the R-help mailing list