Coercing to something like the result of which which()
# S3 method for class 'which'
as.which(x, maxindex = NA_integer_, ...)
# S3 method for class '`NULL`'
as.which(x, ...)
# S3 method for class 'numeric'
as.which(x, maxindex = NA_integer_, ...)
# S3 method for class 'integer'
as.which(x, maxindex = NA_integer_, is.unsorted = TRUE, has.dup = TRUE, ...)
# S3 method for class 'logical'
as.which(x, ...)
# S3 method for class 'ri'
as.which(x, ...)
# S3 method for class 'bit'
as.which(x, range = NULL, ...)
# S3 method for class 'bitwhich'
as.which(x, ...)
as.which(x, ...)an object of classes bit(), bitwhich(),
ri() or something on which which() works
the length of the boolean vector which is represented
further arguments (passed to which() for the
default method, ignored otherwise)
a logical scalar indicating whether the data may be unsorted
a logical scalar indicating whether the data may have duplicates
a ri() or an integer vector of length == 2 giving a
range restriction for chunked processing
a vector of class 'logical' or 'integer'
as.which.bit returns a vector of subscripts with class 'which'
as.which(`NULL`): method to coerce to zero length which() from
NULL
as.which(numeric): method to coerce to which() from numeric()
as.which(integer): method to coerce to which() from integer()
as.which(logical): method to coerce to which() from logical()
as.which(bitwhich): method to coerce to which() from bitwhich()
CoercionToStandard, as.booltype(), as.bit(),
as.bitwhich() , as.which(), as.ri(), ff::as.hi(), ff::as.ff()
r <- ri(5, 20, 100)
x <- as.which(r)
x
#> [1] 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#> attr(,"maxindex")
#> [1] 100
#> attr(,"class")
#> [1] "booltype" "which"
stopifnot(identical(x, as.which(as.logical(r))))
stopifnot(identical(x, as.which(as.bitwhich(r))))
stopifnot(identical(x, as.which(as.bit(r))))