[R] windows vs. linux code

Duncan Murdoch murdoch at stats.uwo.ca
Thu Feb 26 02:42:35 CET 2009

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

More information about the R-help mailing list