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

From: Hin-Tak Leung <hin-tak.leung_at_cimr.cam.ac.uk>
Date: Fri, 21 Sep 2007 03:13:56 +0100

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 <murdoch_at_stats.uwo.ca> 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_at_r-project.org mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>>>
>>>
>>> ______________________________________________
>>> R-devel_at_r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>> ______________________________________________
>> R-devel_at_r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Fri 21 Sep 2007 - 02:17:14 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 21 Sep 2007 - 02:42:17 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.