Re: [Rd] How to test if R is running on a Mac

2007-09-19 Thread Oleg Sklyar
I had the same problem. The following line using either 'apple' or
'darwin' does the job for me (tested on many different Macs):

length(grep("apple", tolower(Sys.getenv("R_PLATFORM" != 0



On Wed, 2007-09-19 at 15:41 +0200, Gorjanc Gregor wrote:
> Hi!
> 
> Is there any way to test if R is running on a Mac? I usually use
> value of .Platform$OS.type for windows or unix, but Mac falls in the
> latter group.
> 
> Thanks, Gregor
> 
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
-- 
Dr Oleg Sklyar * EBI-EMBL, Cambridge CB10 1SD, UK * +44-1223-494466

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] How to test if R is running on a Mac

2007-09-19 Thread Vladimir Eremeev


Gregor Gorjanc-2 wrote:
> 
> Hi!
> 
> Is there any way to test if R is running on a Mac? I usually use
> value of .Platform$OS.type for windows or unix, but Mac falls in the
> latter group.
> 
> Thanks, Gregor
> 

What is in .Platform$path.sep?
Windows has ";", unix has ":".
Mac?
-- 
View this message in context: 
http://www.nabble.com/How-to-test-if-R-is-running-on-a-Mac-tf4481121.html#a12778663
Sent from the R devel mailing list archive at Nabble.com.

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] How to test if R is running on a Mac

2007-09-19 Thread Vladimir Eremeev



Vladimir Eremeev wrote:
> 
> 
> Gregor Gorjanc-2 wrote:
>> 
>> Hi!
>> 
>> Is there any way to test if R is running on a Mac? I usually use
>> value of .Platform$OS.type for windows or unix, but Mac falls in the
>> latter group.
>> 
>> Thanks, Gregor
>> 
> 
> What is in .Platform$path.sep?
> Windows has ";", unix has ":".
> Mac?
> 
And what is in .Platform$file.sep?
-- 
View this message in context: 
http://www.nabble.com/How-to-test-if-R-is-running-on-a-Mac-tf4481121.html#a12778683
Sent from the R devel mailing list archive at Nabble.com.

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] How to test if R is running on a Mac

2007-09-19 Thread Duncan Murdoch
On 9/19/2007 9:41 AM, Gorjanc Gregor wrote:
> Hi!
> 
> Is there any way to test if R is running on a Mac? I usually use
> value of .Platform$OS.type for windows or unix, but Mac falls in the
> latter group.

Remember to also look at .Platform$GUI:  the GUI version behaves quite 
differently from command line R from a user's point of view (both on the 
Mac and on Windows), and occasionally from a programmer's point of view 
(e.g. the graphics device on the Mac).

Duncan

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] How to test if R is running on a Mac

2007-09-19 Thread Henrik Bengtsson
isApple <- function(...) {
  isApple <- FALSE;
  tryCatch({
ans <- readline("Do you see an Apple key on the keyboard you are
typing on? yes/no");
isApple <- (ans == "yes");
  }, mouseClick = function(ex) {
isApple <<- TRUE;
  })
}

/H


On 9/19/07, Duncan Murdoch <[EMAIL PROTECTED]> wrote:
> On 9/19/2007 9:41 AM, Gorjanc Gregor wrote:
> > Hi!
> >
> > Is there any way to test if R is running on a Mac? I usually use
> > value of .Platform$OS.type for windows or unix, but Mac falls in the
> > latter group.
>
> Remember to also look at .Platform$GUI:  the GUI version behaves quite
> differently from command line R from a user's point of view (both on the
> Mac and on Windows), and occasionally from a programmer's point of view
> (e.g. the graphics device on the Mac).
>
> Duncan
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] How to test if R is running on a Mac

2007-09-19 Thread Hin-Tak Leung
On linux boxes,
   version$os and R.version$os
is 'linux-gnu'. I assume that it would be 'darwin-apple' on
Mac's?

Henrik Bengtsson wrote:
> isApple <- function(...) {
>   isApple <- FALSE;
>   tryCatch({
> ans <- readline("Do you see an Apple key on the keyboard you are
> typing on? yes/no");
> isApple <- (ans == "yes");
>   }, mouseClick = function(ex) {
> isApple <<- TRUE;
>   })
> }
> 
> /H
> 
> 
> On 9/19/07, Duncan Murdoch <[EMAIL PROTECTED]> wrote:
>> On 9/19/2007 9:41 AM, Gorjanc Gregor wrote:
>>> Hi!
>>>
>>> Is there any way to test if R is running on a Mac? I usually use
>>> value of .Platform$OS.type for windows or unix, but Mac falls in the
>>> latter group.
>> Remember to also look at .Platform$GUI:  the GUI version behaves quite
>> differently from command line R from a user's point of view (both on the
>> Mac and on Windows), and occasionally from a programmer's point of view
>> (e.g. the graphics device on the Mac).
>>
>> Duncan
>>
>> __
>> R-devel@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
> 
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] How to test if R is running on a Mac

2007-09-20 Thread stefano iacus
what about

 > system("uname")
Darwin

stefano
p.s. if one day R will run on the iPhone, you have to change the  
question below into "Do you see an apple logo somewhere on your  
device?")

On 20/set/07, at 00:37, Hin-Tak Leung wrote:

> On linux boxes,
>version$os and R.version$os
> is 'linux-gnu'. I assume that it would be 'darwin-apple' on
> Mac's?
>
> Henrik Bengtsson wrote:
>> isApple <- function(...) {
>>   isApple <- FALSE;
>>   tryCatch({
>> ans <- readline("Do you see an Apple key on the keyboard you are
>> typing on? yes/no");
>> isApple <- (ans == "yes");
>>   }, mouseClick = function(ex) {
>> isApple <<- TRUE;
>>   })
>> }
>>
>> /H
>>
>>
>> On 9/19/07, Duncan Murdoch <[EMAIL PROTECTED]> wrote:
>>> On 9/19/2007 9:41 AM, Gorjanc Gregor wrote:
 Hi!

 Is there any way to test if R is running on a Mac? I usually use
 value of .Platform$OS.type for windows or unix, but Mac falls in  
 the
 latter group.
>>> Remember to also look at .Platform$GUI:  the GUI version behaves  
>>> quite
>>> differently from command line R from a user's point of view (both  
>>> on the
>>> Mac and on Windows), and occasionally from a programmer's point  
>>> of view
>>> (e.g. the graphics device on the Mac).
>>>
>>> Duncan
>>>
>>> __
>>> R-devel@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>>
>>
>> __
>> R-devel@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] How to test if R is running on a Mac

2007-09-20 Thread Prof Brian Ripley
On Thu, 20 Sep 2007, stefano iacus wrote:

> what about
>
> > system("uname")
> Darwin

Why not use Sys.info() or R.version to find that?

> stefano
> p.s. if one day R will run on the iPhone, you have to change the
> question below into "Do you see an apple logo somewhere on your
> device?")

And in any case other OSes run on Apple hardware: I believe several R 
developers use a MacBook to run Windows or Linux.  Beyond that, R could be 
running remotely, not on the computer to which the keyboard is attached.
Then there is virtualization which allows one OS to run under another.

So I don't if the question was really

- is R running on Mac hardware
- is R running under MacOS X GUI
- is R running under Darwin
...

which all seem reasonable questions, but different ones.  (MacOS X vs 
Darwin is similar to Solaris vs SunOS: the first of the pair includes a 
user interface and not just an OS.)


>
> On 20/set/07, at 00:37, Hin-Tak Leung wrote:
>
>> On linux boxes,
>>version$os and R.version$os
>> is 'linux-gnu'. I assume that it would be 'darwin-apple' on
>> Mac's?
>>
>> Henrik Bengtsson wrote:
>>> isApple <- function(...) {
>>>   isApple <- FALSE;
>>>   tryCatch({
>>> ans <- readline("Do you see an Apple key on the keyboard you are
>>> typing on? yes/no");
>>> isApple <- (ans == "yes");
>>>   }, mouseClick = function(ex) {
>>> isApple <<- TRUE;
>>>   })
>>> }
>>>
>>> /H
>>>
>>>
>>> On 9/19/07, Duncan Murdoch <[EMAIL PROTECTED]> wrote:
 On 9/19/2007 9:41 AM, Gorjanc Gregor wrote:
> Hi!
>
> Is there any way to test if R is running on a Mac? I usually use
> value of .Platform$OS.type for windows or unix, but Mac falls in
> the
> latter group.
 Remember to also look at .Platform$GUI:  the GUI version behaves
 quite
 differently from command line R from a user's point of view (both
 on the
 Mac and on Windows), and occasionally from a programmer's point
 of view
 (e.g. the graphics device on the Mac).

 Duncan

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
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, UKFax:  +44 1865 272595

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] How to test if R is running on a Mac

2007-09-20 Thread Keith Satterley
I use Sys.info()["sysname"].

It returns "Darwin" on a Mac, "Windows" on MS Windows and "Linux" on my Linux 
box. Is this sufficient for your needs,
I'm using R-2.6.0alpha on MS Windows and 2.5.0 on Mac and Linux at the moment.

cheers,

Keith Satterley
Bioinformatics Division
The Walter and Eliza Hall Institute of Medical Research

[EMAIL PROTECTED] wrote:
> Send R-devel mailing list submissions to
>   r-devel@r-project.org
> Message: 1
> Date: Wed, 19 Sep 2007 15:41:22 +0200
> From: Gorjanc Gregor <[EMAIL PROTECTED]>
> Subject: [Rd] How to test if R is running on a Mac
> To: "r-devel@r-project.org" 
> Message-ID:
>   <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset="us-ascii"
> 
> Hi!
> 
> Is there any way to test if R is running on a Mac? I usually use
> value of .Platform$OS.type for windows or unix, but Mac falls in the
> latter group.
> 
> Thanks, Gregor

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] How to test if R is running on a Mac

2007-09-20 Thread Hin-Tak Leung
Prof Ripley had already spoken with a better solution (Sys.info())...

The problem with system("uname") is that it depends on shell behavior
and also the availability of an external utility - 'uname' - i.e. 
although it would work as intended on mac OS X, it would die on windows 
due to not having 'uname' or 'uname' not working the same way... plus 
the usual stdout vs console complications on windows, etc.

stefano iacus wrote:
> what about
> 
>  > system("uname")
> Darwin
> 
> stefano
> p.s. if one day R will run on the iPhone, you have to change the 
> question below into "Do you see an apple logo somewhere on your device?")
> 
> On 20/set/07, at 00:37, Hin-Tak Leung wrote:
> 
>> On linux boxes,
>>version$os and R.version$os
>> is 'linux-gnu'. I assume that it would be 'darwin-apple' on
>> Mac's?
>>
>> Henrik Bengtsson wrote:
>>> isApple <- function(...) {
>>>   isApple <- FALSE;
>>>   tryCatch({
>>> ans <- readline("Do you see an Apple key on the keyboard you are
>>> typing on? yes/no");
>>> isApple <- (ans == "yes");
>>>   }, mouseClick = function(ex) {
>>> isApple <<- TRUE;
>>>   })
>>> }
>>>
>>> /H
>>>
>>>
>>> On 9/19/07, Duncan Murdoch <[EMAIL PROTECTED]> wrote:
 On 9/19/2007 9:41 AM, Gorjanc Gregor wrote:
> Hi!
>
> Is there any way to test if R is running on a Mac? I usually use
> value of .Platform$OS.type for windows or unix, but Mac falls in the
> latter group.
 Remember to also look at .Platform$GUI:  the GUI version behaves quite
 differently from command line R from a user's point of view (both on 
 the
 Mac and on Windows), and occasionally from a programmer's point of view
 (e.g. the graphics device on the Mac).

 Duncan

 __
 R-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-devel

>>>
>>> __
>>> R-devel@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>> __
>> R-devel@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] How to test if R is running on a Mac

2007-09-21 Thread stefano iacus
what about

 > system("uname")
 >
Darwin


stefano

On 19/set/07, at 16:34, Duncan Murdoch wrote:

> On 9/19/2007 9:41 AM, Gorjanc Gregor wrote:
>> Hi!
>>
>> Is there any way to test if R is running on a Mac? I usually use
>> value of .Platform$OS.type for windows or unix, but Mac falls in the
>> latter group.
>
> Remember to also look at .Platform$GUI:  the GUI version behaves quite
> differently from command line R from a user's point of view (both  
> on the
> Mac and on Windows), and occasionally from a programmer's point of  
> view
> (e.g. the graphics device on the Mac).
>
> Duncan
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel