.BG
.FN logical
.FN is.logical
.FN as.logical
.TL
Logical Objects
.CS
logical(length=0)
is.logical(x)
as.logical(x)
.AG length
desired length for the resulting object.
.AG x
any S object.
.RT
`logical' returns a simple object of mode `"logical"', and the length specified.
.PP
`is.logical' returns `TRUE' if `x' has mode `"logical"', and
`FALSE' otherwise.
Its behavior is unaffected by any attributes of `x'; for example, `x' could
be a logical array (in contrast to the behavior of `is.vector').
.PP
`as.logical' returns `x' if `x' is a simple object of mode `"logical"', and
otherwise a logical object of the same length as `x' and with data resulting
from coercing the elements of `x' to mode `"logical"'.
.PP
Simple objects have no attributes.
Logical objects will be coerced automatically to numeric for arithmetic
and other numeric computations.  In the coercion, `TRUE' becomes `1'  and
`FALSE' becomes 0.
Conversely, numeric objects will be coerced to logical by setting all
non-zero values to `TRUE'.  Note that there is no allowance for rounding
error in doing this, so it is not a good practice, except for
computations known to have integer results.
.PP
Note the difference between coercing to a simple object of mode `"logical"'
and setting the mode attribute:
.Cs
mode(myobject) <- "logical"
.Ce
This changes the mode of `myobject' but leaves all other attributes unchanged
(so a matrix stays a matrix, e.g.).  The value of `as.logical(myobject)'
would have no attributes.  Similarly, `is.logical' would return `FALSE' for
a matrix of logical data.
.EX
logical(length(zz)) # logical object same length as zz
\&.Fortran("mysub",as.logical(xm))
.KW classes
.WR
