R: Coercion to (positive) integer positions

as.which {bit} | R Documentation

## Coercion to (positive) integer positions

### Description

Coercing to something like the result of which `which`

### Usage

    as.which(x, ...)
    ## Default S3 method:
    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, ...)

### Arguments

`x` | an object of classes `bit`, `bitwhich`, `ri` or something on which `which` works
`range` | a `ri` or an integer vector of length==2 giving a range restriction for chunked processing
`...` | further arguments (passed to `which` for the default method, ignored otherwise)

### Details

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

### Value

a vector of class 'logical' or 'integer'

### Author(s)

Jens Oehlschlägel

### See Also

`as.bit`, `as.logical`, `as.integer`, `as.which`, `as.bitwhich`, `as.ff`, `as.hi`

### Examples

      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))))

[Package bit version 1.1-15 Index]