bit (version 4.0.5)

as.which.which: Coercion to (positive) integer positions

Description

Coercing to something like the result of which which

Usage

# S3 method for which
as.which(x, maxindex = NA_integer_, ...)

# S3 method for `NULL` as.which(x, ...)

# S3 method for numeric as.which(x, maxindex = NA_integer_, ...)

# S3 method for integer as.which(x, maxindex = NA_integer_, is.unsorted = TRUE, has.dup = TRUE, ...)

# S3 method for logical as.which(x, ...)

# S3 method for ri as.which(x, ...)

# S3 method for bit as.which(x, range = NULL, ...)

# S3 method for bitwhich as.which(x, ...)

as.which(x, ...)

Value

a vector of class 'logical' or 'integer'

Arguments

x

an object of classes bit, bitwhich, ri or something on which which works

maxindex

the length of the boolean vector which is represented

...

further arguments (passed to which for the default method, ignored otherwise)

is.unsorted

a logical scalar indicating whether the data may be unsorted

has.dup

a logical scalar indicating whether the data may have duplicates

range

a ri or an integer vector of length==2 giving a range restriction for chunked processing

Methods (by class)

  • which: method to coerce to which from which

  • NULL: method to coerce to zero length which from NULL

  • numeric: method to coerce to which from numeric

  • integer: method to coerce to which from integer

  • logical: method to coerce to which from logical

  • ri: method to coerce to which from ri

  • bit: method to coerce to which from bit

  • bitwhich: method to coerce to which from bitwhich

Author

Jens Oehlschlägel

Details

as.which.bit returns a vector of subscripts with class 'which'

See Also

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

Examples

Run this code

  r <- ri(5, 20, 100)
  x <- as.which(r)
  x

  stopifnot(identical(x, as.which(as.logical(r))))
  stopifnot(identical(x, as.which(as.bitwhich(r))))
  stopifnot(identical(x, as.which(as.bit(r))))

Run the code above in your browser using DataLab