extract_array: extract_array

Description Usage Arguments Details Value See Also Examples


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


extract_array(x, index)




An array-like object.


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.


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.


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


## Coming soon...

DelayedArray documentation built on March 25, 2021, 6:01 p.m.