Test for scalar TRUE.

DESCRIPTION:

Test for logical object of length one with value TRUE.

USAGE:

isTRUE(x)

REQUIRED ARGUMENTS:

x
Anything.

VALUE:

TRUE if x is a logical vector of length one whose value is TRUE. Otherwise FALSE. Attributes of x, such as names or dimensions, are ignored.

DETAILS:

isTRUE is handy for testing the results of functions like all.equal() and getOption(), which may return TRUE on success and character strings or NULL on failure.

This function differs slightly from the R implementation of isTRUE, which is identical(TRUE, x), and thus would return FALSE for isTRUE(c(one=1)==1) .

SEE ALSO:

,

EXAMPLES:

isTRUE(all.equal(sqrt(14), sqrt(2)*sqrt(7))) &&
    isTRUE(all.equal(1:2,1:3)) # FALSE
isTRUE(getOption("unusualOption")) # FALSE if this option not set or FALSE
options(unusualOption = TRUE)
isTRUE(getOption("unusualOption")) # TRUE
isTRUE(c(Value=TRUE)) # TRUE in S-PLUS, FALSE in R