extract_array
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) type(x)
x |
An array-like object. |
index |
An unnamed list of subscripts as positive integer vectors, one vector
per dimension in |
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.
array and data.frame objects in base R.
DataFrame objects in the S4Vectors package.
DelayedArray objects.
## Coming soon...
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.