"logical"
, and the basic
logical constants.TRUE
FALSE
T; Flogical(length = 0)
as.logical(x, …)
is.logical(x)
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 factor
s, this uses the levels
(labels). Like as.vector
it strips attributes including
names. Character strings c("T", "TRUE", "True", "true")
are
regarded as true, c("F", "FALSE", "False", "false")
as false,
and all others as NA
. is.logical
returns TRUE
or FALSE
depending on
whether its argument is of logical type or not.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
to NA_integer_
.NA
, the other logical constant.