extract_array {DelayedArray} | R Documentation

## extract_array

### Description

`extract_array` is an internal generic function not aimed to be used directly by the user. It has methods defined for array, data.frame, DataFrame objects and other array-like objects.

The `DelayedArray()` constructor function will accept any seed that complies with the seed contract i.e. that supports `dim()`, `dimnames()`, and `extract_array()`.

### Usage

    extract_array(x, index)

    type(x)

### Arguments

`x` | An array-like object.
`index` | An unnamed list of subscripts as positive integer vectors, one vector per dimension in `x`. Empty and missing subscripts (represented by `integer(0)` and `NULL` list elements, respectively) are allowed. The subscripts can contain duplicated indices. They cannot contain NAs or non-positive values.

### Details

`extract_array` methods need to support empty and missing subscripts e.g. `extract_array(x, list(NULL, integer(0)))` must return an M x 0 matrix and `extract_array(x, list(integer(0), integer(0)))` a 0 x 0 matrix.

Also subscripts are allowed to contain duplicated indices so things like `extract_array(seed, list(c(1:3, 3:1), 2L))` need to be supported.

`type(x)` returns the type of the elements in `x`. It's equivalent to `typeof(x)` or `storage.mode(x)` on an ordinary array or vector. It works out-of-the-box on any array-like object `x` for which `extract_array(x)` works.

### Value

`extract_array` must return an ordinary array of the appropriate type (i.e. integer, double, etc...). For example, if `x` is an object representing an M x N matrix of complex numbers, `extract_array(x, list(NULL, 2L))` must return its 2nd column as an ordinary M x 1 matrix of type complex.

`type` returns the type of the array elements.

### See Also

- `read_block`.

- array and data.frame objects in base R.

- DataFrame objects in the S4Vectors package.

- DelayedArray objects.

### Examples

    ## Coming soon...

[Package DelayedArray version 0.12.3 Index]