Are we using \R, rather than S?

Usage

is.R()

Description

is.R returns TRUE if we are using R and FALSE otherwise.

The function has been written such as to correctly run in all versions of R, S and S-plus. In order for code to be runnable in both R and S dialects, either your the code must define is.R or use it as

if (exists(is.R) && is.function(is.R) && is.R()) {
## R-specific code
} else {
## S-version of code
}

See Also

version, system.

Examples

x <- runif(20); small <- x < 0.4
# which only exists in R:
if(is.R()) which(small) else seq(along=small)[small]


[Package Contents]