Last chance! 50% off unlimited learning
Sale ends in
Coercing to bit vector
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 bitwhich
as.bit(x, …)
# S3 method for which
as.bit(x, length, …)
# S3 method for ri
as.bit(x, …)
the length of the new bit vector
further arguments
is.bit
returns FALSE or TRUE, as.bit
returns a vector of class 'bit'
Coercing to bit is quite fast because we use a double loop that fixes each word in a processor register
# NOT RUN {
x <- as.bit(c(FALSE, NA, TRUE))
as.bit(x)
as.bit.which(c(1,3,4), 12)
# }
Run the code above in your browser using DataLab