windows vs. linux code

classic Classic list List threaded Threaded
18 messages Options
Reply | Threaded
Open this post in threaded view
|

windows vs. linux code

Sherri Heck
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.

cheers-

sherri

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: windows vs. linux code

Rolf Turner

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 confid...{{dropped:9}}

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: windows vs. linux code

jdeisenberg
In reply to this post by Sherri Heck

Sherri Heck wrote
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.
Linux and Windows use different end-of-line delimiters, but R doesn't care about that.

If the code uses the system( ) call to directly invoke an OS command, then that code is almost certainly tied down to one operating system.  For example, system("date") works fine on Linux, but doesn't on Windows.
Reply | Threaded
Open this post in threaded view
|

Re: windows vs. linux code

Sherri Heck
In reply to this post by Rolf Turner
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
> ######################################################################

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: windows vs. linux code

David Winsemius
Definitely "maybe". Possibly "yes". Usually.

Pick one of the above.

--  
David Winsemius

On Feb 25, 2009, at 8:25 PM, 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
>> ######################################################################
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: windows vs. linux code

jdeisenberg
In reply to this post by Sherri Heck
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.
Yes, if you avoid system-dependent calls like, um, system <grin/>, there should be no problem. For example, normal stuff like t test, correlation, plot, hist, barplot, matrix, etc. transfers nicely. CSV files created on one system can be read on the other.

But to give a definitive answer for a particular case, we need to see the code.
Reply | Threaded
Open this post in threaded view
|

Re: windows vs. linux code

Sherri Heck
In reply to this post by David Winsemius
hahaha!  okay.  at least your responses are positive!  thx!

David Winsemius wrote:

> Definitely "maybe". Possibly "yes". Usually.
>
> Pick one of the above.
>
> -- David Winsemius
>
> On Feb 25, 2009, at 8:25 PM, 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
>>> ######################################################################
>>
>> ______________________________________________
>> [hidden email] 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.
>

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: windows vs. linux code

Duncan Murdoch
In reply to this post by jdeisenberg
On 25/02/2009 8:19 PM, jdeisenberg wrote:

>
>
> Sherri Heck wrote:
>> 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.
>>
>
> Linux and Windows use different end-of-line delimiters, but R doesn't care
> about that.
>
> If the code uses the system( ) call to directly invoke an OS command, then
> that code is almost certainly tied down to one operating system.  For
> example, system("date") works fine on Linux, but doesn't on Windows.

Well, not on some Windows systems.  On mine, I get

 > system("date")
Wed Feb 25 20:37:10 EST 2009

This is because I have the date command installed as part of the R
tools.  (Date is also available in a number of other toolkits that make
Windows shells more Unix-like.)

So your point is valid that code written to use system functions on
Linux is unlikely to work in a plain out of the box Windows system, but
it's often not hard to get it to run.

Duncan Murdoch

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: windows vs. linux code

Murray Cooper
In reply to this post by Rolf Turner
I'm deeply disappointed! I keep checking the mail list to see if you guys
are posting answers to questions I haven't asked yet. It would save me a lot
of time!

Best,

Murray

----- Original Message -----
From: "Rolf Turner" <[hidden email]>
To: "Sherri Heck" <[hidden email]>
Cc: <[hidden email]>
Sent: Wednesday, February 25, 2009 8:16 PM
Subject: Re: [R] windows vs. linux code


>
> 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 confid...{{dropped:9}}
>
> ______________________________________________
> [hidden email] 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.
>

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: windows vs. linux code

Ted.Harding-2
In reply to this post by Sherri Heck
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
>> ######################################################################
>
> ______________________________________________
> [hidden email] 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) <[hidden email]>
Fax-to-email: +44 (0)870 094 0861
Date: 26-Feb-09                                       Time: 03:58:35
------------------------------ XFMail ------------------------------

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: windows vs. linux code

Gabor Grothendieck
On Wed, Feb 25, 2009 at 10:58 PM, Ted Harding
<[hidden email]> wrote:
>
>  if(length(grep("linux",R.Version()$os))){
>  windows <- function( ... ) X11( ... )
> }
>

Try

if (.Platform$OS.type == "windows") ... else ...

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: windows vs. linux code

Sherri Heck
In reply to this post by Ted.Harding-2
hi ted-

thanks for your insight. i appreciate it.

sherri

(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].
>
> 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
>>> ######################################################################
>>>      
>> ______________________________________________
>> [hidden email] 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) <[hidden email]>
> Fax-to-email: +44 (0)870 094 0861
> Date: 26-Feb-09                                       Time: 03:58:35
> ------------------------------ XFMail ------------------------------
>

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: windows vs. linux code

Kingsford Jones
In reply to this post by Ted.Harding-2
X11() on my Vista machine running 2.8.1 seems to work the same as
windows().  From the help page, the only difference I see is that
'X11' (and 'x11') have only width, height and pointsize arguments
('windows' has another 13).

Kingsford

On Wed, Feb 25, 2009 at 8:58 PM, Ted Harding
<[hidden email]> 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].
>
> 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
>>> ######################################################################
>>
>> ______________________________________________
>> [hidden email] 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) <[hidden email]>
> Fax-to-email: +44 (0)870 094 0861
> Date: 26-Feb-09                                       Time: 03:58:35
> ------------------------------ XFMail ------------------------------
>
> ______________________________________________
> [hidden email] 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.
>

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: windows vs. linux code

Prof Brian Ripley
In reply to this post by Ted.Harding-2
I think what in my experience is the most common causen for R code
being confined to one platform has not yet been mentioned: it needs a
package that is only available on one platform: of CRAN/BioC packages
that is only a small proprtion, but out of 2000 a small proportion is
still tens.

On Thu, 26 Feb 2009, [hidden email] wrote:

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

Not in my experience, and definitely not in well-written code.
Programmers should let users manage devices for themselves.

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

This is what dev.new() is for: it is cross-platform.

But if X11() or x11() has been used, that will work on Windows
(although not for all arguments), and has since 1998.

We do occasionally see problems in packaees where exmaples try to
open a specific device at a specific size: that may simply be
impossible on the user's machine.

> 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
>>> ######################################################################
>>
>> ______________________________________________
>> [hidden email] 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) <[hidden email]>
> Fax-to-email: +44 (0)870 094 0861
> Date: 26-Feb-09                                       Time: 03:58:35
> ------------------------------ XFMail ------------------------------
>
> ______________________________________________
> [hidden email] 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.
>

--
Brian D. Ripley,                  [hidden email]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: windows vs. linux code

Wacek Kusnierczyk
In reply to this post by Ted.Harding-2
(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
>>> ######################################################################
>>>      
>> ______________________________________________
>> [hidden email] 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) <[hidden email]>
> Fax-to-email: +44 (0)870 094 0861
> Date: 26-Feb-09                                       Time: 03:58:35
> ------------------------------ XFMail ------------------------------
>
> ______________________________________________
> [hidden email] 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: [hidden email]
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

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: windows vs. linux code

Paul Gilbert
In reply to this post by Gabor Grothendieck
Gabor Grothendieck wrote:
....
> Try
>
> if (.Platform$OS.type == "windows") ... else ...

Gabor has suggested what I think is the best way to do this check, but
in my experience, if you are doing this check then you are almost
certainly missing some feature of R that will let you avoid doing it.

For graphs, dev.new() has been mentioned.  I would be curious to know
when people find it necessary to do this check, other than to issue a
system() command for some very specialized local system reason (i.e.
something that would never be used in a package and rarely in code run
on different computers - not just different OSs).

Paul
====================================================================================

La version française suit le texte anglais.

------------------------------------------------------------------------------------

This email may contain privileged and/or confidential information, and the Bank of
Canada does not waive any related rights. Any distribution, use, or copying of this
email or the information it contains by other than the intended recipient is
unauthorized. If you received this email in error please delete it immediately from
your system and notify the sender promptly by email that you have done so.

------------------------------------------------------------------------------------

Le présent courriel peut contenir de l'information privilégiée ou confidentielle.
La Banque du Canada ne renonce pas aux droits qui s'y rapportent. Toute diffusion,
utilisation ou copie de ce courriel ou des renseignements qu'il contient par une
personne autre que le ou les destinataires désignés est interdite. Si vous recevez
ce courriel par erreur, veuillez le supprimer immédiatement et envoyer sans délai à
l'expéditeur un message électronique pour l'aviser que vous avez éliminé de votre
ordinateur toute copie du courriel reçu.
______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: windows vs. linux code

Prof Brian Ripley
On Thu, 26 Feb 2009, Paul Gilbert wrote:

> Gabor Grothendieck wrote:
> ....
>> Try
>>
>> if (.Platform$OS.type == "windows") ... else ...
>
> Gabor has suggested what I think is the best way to do this check, but in my
> experience, if you are doing this check then you are almost certainly missing
> some feature of R that will let you avoid doing it.
>
> For graphs, dev.new() has been mentioned.  I would be curious to know when
> people find it necessary to do this check, other than to issue a system()
> command for some very specialized local system reason (i.e. something that
> would never be used in a package and rarely in code run on different
> computers - not just different OSs).

Grep-ing the R and package sources is informative.

One place that such a test is needed is for system/shell differences,
and the fact that some Windows commands need \ as the file separator
(and some need / or shell-specific quoting).  Quite a few packages are
calling e.g. gs (where the name is platform-dependent).

Some packages seem to treat tk differently by platform, but that seems
to me to be largely a legacy of Tk 8.4: 8.5 is more portable.

But many uses in packages are no longer necessary, e.g. flush.console
exists everywhere, and R 2.9.0 will have an unzip() function.

--
Brian D. Ripley,                  [hidden email]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: windows vs. linux code

Jeffrey J. Hallman-2
In reply to this post by Rolf Turner
Rolf Turner <[hidden email]> writes:
> 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.

Oh, yeah?  Then how did I know you were going to say that, huh?

--
Jeff

______________________________________________
[hidden email] 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.