This help topic is for R version 2.9.0. For the current version of R, try https://stat.ethz.ch/R-manual/R-patched/library/base/html/logical.html
logical {base}R Documentation

Logical Vectors

Description

Create or test for objects of type "logical", and the basic logical constants.

Usage

TRUE
FALSE
T; F

logical(length = 0)
as.logical(x, ...)
is.logical(x)

Arguments

length

desired length.

x

object to be coerced or tested.

...

further arguments passed to or from other methods.

Details

TRUE and FALSE are reserved words denoting logical constants in the R language, whereas T and F are global variables whose initial values set to these. All four are logical(1) vectors.

Logical vectors are coerced to integer vectors in contexts where a numerical value is required, with TRUE being mapped to 1L, FALSE to 0L and NA_LOGICAL_ to NA_INTEGER_.

Value

logical creates a logical vector of the specified length. Each element of the vector is equal to FALSE.

as.logical attempts to coerce its argument to be of logical type. For factors, this uses the levels (labels). Like as.vector it strips attributes including names.

is.logical returns TRUE or FALSE depending on whether its argument is of logical type or not.

References

Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.

See Also

NA, the other logical constant.


[Package base version 2.9.0 ]