Description Usage Arguments Details Value Author(s) See Also Examples
Coercing from bit to logical, integer, which.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ## S3 method for class 'bit'
as.logical(x, ...)
## S3 method for class 'bitwhich'
as.logical(x, ...)
## S3 method for class 'ri'
as.logical(x, ...)
## S3 method for class 'bit'
as.integer(x, ...)
## S3 method for class 'bitwhich'
as.integer(x, ...)
## S3 method for class 'ri'
as.integer(x, ...)
## S3 method for class 'bit'
as.double(x, ...)
## S3 method for class 'bitwhich'
as.double(x, ...)
## S3 method for class 'ri'
as.double(x, ...)
|
x |
an object of class |
... |
ignored |
Coercion from bit is quite fast because we use a double loop that fixes each word in a processor register.
as.logical
returns a vector of FALSE, TRUE
, as.integer
and as.double
return a vector of 0,1
.
Jens Oehlschlägel
as.bit
, as.which
, as.bitwhich
, as.ff
, as.hi
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | x <- ri(2, 5, 10)
y <- as.logical(x)
y
stopifnot(identical(y, as.logical(as.bit(x))))
stopifnot(identical(y, as.logical(as.bitwhich(x))))
y <- as.integer(x)
y
stopifnot(identical(y, as.integer(as.logical(x))))
stopifnot(identical(y, as.integer(as.bit(x))))
stopifnot(identical(y, as.integer(as.bitwhich(x))))
y <- as.double(x)
y
stopifnot(identical(y, as.double(as.logical(x))))
stopifnot(identical(y, as.double(as.bit(x))))
stopifnot(identical(y, as.double(as.bitwhich(x))))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.