View source: R/delarr-backends.R
| delarr_backend | R Documentation |
Provides a convenience helper that turns a user-supplied slice function into
a ready-to-use delarr object.
delarr_backend(
nrow,
ncol,
pull,
chunk_hint = NULL,
dimnames = NULL,
begin = NULL,
end = NULL
)
nrow, ncol |
Dimensions of the logical matrix. |
pull |
Function of |
chunk_hint |
Optional preferred chunking metadata. |
dimnames |
Optional dimnames to expose lazily. |
begin |
Optional function invoked before streaming. |
end |
Optional function invoked after streaming. |
A delarr backed by the provided pull function.
# Create a custom backend from a pull function
data <- matrix(1:20, nrow = 4, ncol = 5)
darr <- delarr_backend(
nrow = 4,
ncol = 5,
pull = function(rows = NULL, cols = NULL) {
rows <- rows %||% seq_len(4)
cols <- cols %||% seq_len(5)
data[rows, cols, drop = FALSE]
}
)
darr
# Use like any delarr
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.