Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

extract_array

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

Examples

## Coming soon...

DelayedArray

A unified framework for working transparently with on-disk and in-memory array-like datasets

v0.16.3
Artistic-2.0
Authors
Hervé Pagès <hpages.on.github@gmail.com>, with contributions from Peter Hickey <peter.hickey@gmail.com> and Aaron Lun <infinite.monkeys.with.keyboards@gmail.com>
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.