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

Henrik Bengtsson hb at stat.berkeley.edu
Wed Sep 19 22:51:11 CEST 2007


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
>



More information about the R-devel mailing list