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
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 at 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
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.
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.
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
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 r-devel-request at r-project.org wrote:> Send R-devel mailing list submissions to > r-devel at r-project.org > Message: 1 > Date: Wed, 19 Sep 2007 15:41:22 +0200 > From: Gorjanc Gregor <Gregor.Gorjanc at bfro.uni-lj.si> > Subject: [Rd] How to test if R is running on a Mac > To: "r-devel at r-project.org" <r-devel at r-project.org> > Message-ID: > <F189E18BBAA8B6479F618B9044CF4E9C0188517825 at owa.bfro.uni-lj.si> > 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