| delarr_seed | R Documentation |
delarrSeeds encapsulate storage access for delayed matrices. They define matrix
dimensions and a pull() function that returns materialised slices.
delarr_seed(
nrow,
ncol,
pull,
chunk_hint = NULL,
dimnames = NULL,
begin = NULL,
end = NULL
)
nrow, ncol |
Number of rows and columns. |
pull |
A function accepting |
chunk_hint |
Optional list describing preferred chunk sizes
(e.g. |
dimnames |
Optional list of dimnames to expose lazily. |
begin |
Optional function invoked before streaming begins. |
end |
Optional function invoked after streaming completes. |
An object of class delarr_seed.
# Create a custom seed with a pull function
data <- matrix(1:12, nrow = 3, ncol = 4)
seed <- delarr_seed(
nrow = 3,
ncol = 4,
pull = function(rows = NULL, cols = NULL) {
rows <- rows %||% seq_len(3)
cols <- cols %||% seq_len(4)
data[rows, cols, drop = FALSE]
}
)
seed
# Wrap in delarr() to use with lazy operations
darr <- delarr(seed)
result <- darr |> d_map(~ .x * 2) |> collect()
result
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.