[R] windows vs. linux code

Wacek Kusnierczyk Waclaw.Marcin.Kusnierczyk at idi.ntnu.no
Thu Feb 26 09:11:16 CET 2009


(Ted Harding) wrote:
> 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].
>   

as far as i understand, you can just dev.new() instead, if not in all
then in most circumstances, which will do the system-dependent stuff for
you, making your code less system-dependent.

vQ

> 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 ------------------------------
>
> ______________________________________________
> 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.
>   


-- 
-------------------------------------------------------------------------------
Wacek Kusnierczyk, MD PhD

Email: waku at idi.ntnu.no
Phone: +47 73591875, +47 72574609

Department of Computer and Information Science (IDI)
Faculty of Information Technology, Mathematics and Electrical Engineering (IME)
Norwegian University of Science and Technology (NTNU)
Sem Saelands vei 7, 7491 Trondheim, Norway
Room itv303

Bioinformatics & Gene Regulation Group
Department of Cancer Research and Molecular Medicine (IKM)
Faculty of Medicine (DMF)
Norwegian University of Science and Technology (NTNU)
Laboratory Center, Erling Skjalgsons gt. 1, 7030 Trondheim, Norway
Room 231.05.060




More information about the R-help mailing list