as.bit: Coercing to bit

Description Usage Arguments Details Value Note Author(s) See Also Examples

View source: R/generics.R

Description

Coercing to bit vector

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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 'bitwhich'
as.bit(x, ...)
## S3 method for class 'which'
as.bit(x, length, ...)
## S3 method for class 'ri'
as.bit(x, ...)

Arguments

x

an object of class bit, logical, integer, bitwhich or an integer from as.which or a boolean ff

length

the length of the new bit vector

...

further arguments

Details

Coercing to bit is quite fast because we use a double loop that fixes each word in a processor register

Value

is.bit returns FALSE or TRUE, as.bit returns a vector of class 'bit'

Note

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.

Author(s)

Jens Oehlschl?gel

See Also

bit, as.logical

Examples

1
2
3
  x <- as.bit(c(FALSE, NA, TRUE))
  as.bit(x)
  as.bit.which(c(1,3,4), 12)

OHDSI/bit documentation built on May 9, 2017, 3:30 p.m.