[R] Canonical method for S engine selection?

2006-12-06 Thread Paul Roebuck
Assuming script 'common.q' contains code that needed
different processing depending on interpreter
(either S-PLUS or R), what should the condition be?

if (condition) {
# Do S-PLUS code
} else {
# Do R code
}

Looking for something akin to the C preprocessor directive
USING_R, but for S.

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Canonical method for S engine selection?

2006-12-06 Thread Duncan Murdoch
On 12/6/2006 5:02 PM, Paul Roebuck wrote:
 Assuming script 'common.q' contains code that needed
 different processing depending on interpreter
 (either S-PLUS or R), what should the condition be?
 
 if (condition) {
 # Do S-PLUS code
 } else {
 # Do R code
 }
 
 Looking for something akin to the C preprocessor directive
 USING_R, but for S.

See ?is.R.  This function is defined in both R and current versions of 
S-PLUS; there are instructions for how to put together a test that works 
in older S-PLUS versions too.

Duncan Murdoch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Canonical method for S engine selection?

2006-12-06 Thread Thomas Lumley
On Wed, 6 Dec 2006, Paul Roebuck wrote:

 Assuming script 'common.q' contains code that needed
 different processing depending on interpreter
 (either S-PLUS or R), what should the condition be?


I believe
   exists(is.R)  is.R()
is a reliable condition.

-thomas

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.