| shard_writer | R Documentation |
collect()Creates a writer object backed by shard::buffer() conforming to delarr's
writer protocol. Pass to collect(x, into = shard_writer(...)) to stream
results into shared memory.
shard_writer(nrow, ncol, backing = "auto")
nrow, ncol |
Dimensions of the output matrix. |
backing |
Backing type passed to |
A writer list with $write(), $finalize(), $result(), and
$close() methods.
This writer supports 2D matrices only. N-d array collection does not
currently support writer-style into targets.
if (requireNamespace("shard", quietly = TRUE)) {
mat <- matrix(rnorm(20), 4, 5)
darr <- delarr(mat)
w <- shard_writer(4, 5)
collect(darr |> d_map(~ .x * 2), into = w)
w$result()
w$close()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.