Coercing to bit vector
# S3 method for `NULL`
as.bit(x, ...)# S3 method for bit
as.bit(x, ...)
# S3 method for logical
as.bit(x, ...)
# S3 method for integer
as.bit(x, ...)
# S3 method for double
as.bit(x, ...)
# S3 method for bitwhich
as.bit(x, ...)
# S3 method for which
as.bit(x, length = attr(x, "maxindex"), ...)
# S3 method for ri
as.bit(x, ...)
as.bit(x = NULL, ...)
is.bit
returns FALSE or TRUE, as.bit
returns a vector
of class 'bit'
as.bit(`NULL`)
: method to coerce to bit()
(zero length) from NULL
as.bit(bit)
: method to coerce to bit()
from bit()
as.bit(logical)
: method to coerce to bit()
from logical()
as.bit(integer)
: method to coerce to bit()
from
integer()
(0L
and NA
become FALSE
,
everthing else becomes TRUE
)
as.bit(double)
: method to coerce to bit()
from
double()
(0
and NA
become FALSE
, everthing
else becomes TRUE
)
as.bit(bitwhich)
: method to coerce to bit()
from bitwhich()
as.bit(which)
: method to coerce to bit()
from which()
as.bit(ri)
: method to coerce to bit()
from ri()
Jens Oehlschlägel
Coercing to bit is quite fast because we use a double loop that fixes each word in a processor register
CoercionToStandard
, as.booltype()
, as.bit()
,
as.bitwhich()
, as.which()
, as.ri()
, ff::as.hi()
, ff::as.ff()
as.bit(c(0L, 1L, 2L, -2L, NA))
as.bit(c(0, 1, 2, -2, NA))
as.bit(c(FALSE, NA, TRUE))
Run the code above in your browser using DataLab