From Martin Maechler <maechler@stat.math.ethz.ch>  Fri Dec 26 15:27:14 1997
From: Martin Maechler <maechler@stat.math.ethz.ch> (Martin Maechler)
Date: Fri, 26 Dec 1997 16:27:14 +0100
Subject: "ifdef"'ing R/S code:  if(is.R())
In-Reply-To: <6rvhwcgmsj.fsf@franz.stat.wisc.edu> (message from Douglas Bates
 on 26 Dec 1997 09:13:32 -0600)
Message-ID: <199712261527.QAA23058@jessica.ethz.ch>

>>>>> "DougB" == Douglas Bates <bates@stat.wisc.edu> writes:

    DougB> I should have saved the messages about this but I didn't.  Can
    DougB> someone remind me of what function or object to check from
    DougB> within a function to determine if you are running R?  I need to
    DougB> make some changes in code according to whether I am running it
    DougB> under R or under S and I would prefer to keep one source tree.

##>>>>>> This works in all of <<<<<
##-- S  (including "S version 4", (beta))
##-- R
##-- S-plus

is.R <- function() { ## returns  'TRUE'  iff we are using 'R'
  exists("version") && !is.null(vl <- version$language) && vl == "R"
}

#- some may want:
is.S <- function() !is.R()

--------------
I think I should add this function to the R base,
or do we need a new package  "Scompatibility"  which could server other
things as well? 

I for one, am having more and more need for an "Rcompatibility" package in
S...

Martin
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


"ifdef"'ing R/S code: if(is.R())
Martin Maechler