isTRUE
Test for the Value TRUE

Description

Test for a logical object of length one with the value TRUE.

Usage

isTRUE(x)

Arguments

x The element, object, string, evaluation, or any other type to test.

Details

isTRUE is handy for testing the results of functions like all.equal() and getOption(), which can 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 returns FALSE for isTRUE(c(one=1)==1).
Value
returns TRUE if x is a logical vector of length one whose value is TRUE. Otherwise returns FALSE. Attributes of x, such as names or dimensions, are ignored.
See Also
all.equal,identical
Examples
isTRUE(all.equal(sqrt(14), sqrt(2)*sqrt(7))) &&
    isTRUE(all.equal(1:2,1:3)) # FALSE

# FALSE if this option not set or FALSE isTRUE(getOption("unusualOption")) options(unusualOption = TRUE) isTRUE(getOption("unusualOption")) # TRUE

isTRUE(c(Value=TRUE)) # FALSE in S engines

Package base version 4.0.0-28
Package Index