as.bit: Coercing to bit

Description Usage Arguments Details Value Methods (by class) 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
14
15
16
17
18
19
20
21
22
23
24
25
## 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, ...)

Arguments

x

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

...

further arguments

length

the length of the new bit vector

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'

Methods (by class)

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

CoercionToStandard, as.booltype, as.bit, as.bitwhich , as.which, as.ri, as.hi, as.ff

Examples

1
2
3
4
as.bit(c(0L,1L,2L,-2L,NA))
as.bit(c(0,1,2,-2,NA))

as.bit(c(FALSE, NA, TRUE))

bit documentation built on Aug. 4, 2020, 9:06 a.m.