ConstantArray | R Documentation |
A DelayedArray subclass to efficiently mimic an array containing a constant value, without actually creating said array in memory.
## Constructor function:
ConstantArray(dim, value=NA)
dim |
The dimensions (specified as an integer vector) of the ConstantArray object to create. |
value |
Vector (atomic or list) of length 1, containing the value to fill the matrix. |
This class allows us to efficiently create arrays containing a single value.
For example, we can create matrices full of NA
values, to serve as
placeholders for missing assays when combining SummarizedExperiment objects.
A ConstantArray (or ConstantMatrix) object. (Note that ConstantMatrix extends ConstantArray.)
Aaron Lun
DelayedArray objects.
DelayedArray-utils for common operations on DelayedArray objects.
RleArray objects for representing in-memory Run Length Encoded array-like datasets.
## This would ordinarily take up 8 TB of memory:
CM <- ConstantArray(c(1e6, 1e6), value=NA_real_)
CM
CM2 <-ConstantArray(c(4, 1e6), value=55)
rbind(CM, CM2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.