\HeaderA{is.R}{Are we using R, rather than S?}{is.R}
\keyword{environment}{is.R}
\keyword{utilities}{is.R}
\begin{Description}\relax
Test if running under \R.
\end{Description}
\begin{Usage}
\begin{verbatim}
is.R()
\end{verbatim}
\end{Usage}
\begin{Details}\relax
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,
your code must either define \code{is.R} or use it as

\code{if (exists("is.R") \&\& is.function(is.R) \&\& is.R()) \{}\\
\code{    }\emph{\#\# R-specific code}\\
\code{\} else \{}\\
\code{    }\emph{\#\# S-version of code}\\
\code{\}}
\end{Details}
\begin{Value}
\code{is.R} returns \code{TRUE} if we are using \R{} and \code{FALSE}
otherwise.
\end{Value}
\begin{SeeAlso}\relax
\code{\LinkA{R.version}{R.version}}, \code{\LinkA{system}{system}}.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
x <- runif(20); small <- x < 0.4
## 'which()' only exists in R:
if(is.R()) which(small) else seq(along=small)[small]
\end{ExampleCode}
\end{Examples}

