Coercing to bit
Coercing to bit vector
## S3 method for class ''NULL'' as.bit(x, ...) ## S3 method for class 'bit' as.bit(x, ...) ## S3 method for class 'logical' as.bit(x, ...) ## S3 method for class 'integer' as.bit(x, ...) ## S3 method for class 'double' as.bit(x, ...) ## S3 method for class 'bitwhich' as.bit(x, ...) ## S3 method for class 'which' as.bit(x, length = attr(x, "maxindex"), ...) ## S3 method for class 'ri' as.bit(x, ...) as.bit(x = NULL, ...)
Coercing to bit is quite fast because we use a double loop that fixes each word in a processor register
is.bit
returns FALSE or TRUE, as.bit
returns a vector
of class 'bit'
Zero is coerced to FALSE, all other numbers including NA are coerced to TRUE. This differs from the NA-to-FALSE coercion in package ff and may change in the future.
Jens Oehlschlägel
as.bit(c(0L,1L,2L,-2L,NA)) as.bit(c(0,1,2,-2,NA)) as.bit(c(FALSE, NA, TRUE))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.