Uses the mmap package to lazily read slices from a binary file on demand. The file must contain raw numeric data in column-major order (R's default).
Note
This backend supports 2D matrices only. For N-d arrays, use
delarr_hdf5() or wrap an in-memory array with delarr().
Examples
if (requireNamespace("mmap", quietly = TRUE)) {
# Create a binary file with matrix data
mat <- matrix(1:20, nrow = 4, ncol = 5)
tf <- tempfile()
writeBin(as.double(mat), tf)
# Load as delayed array
darr <- delarr_mmap(tf, nrow = 4, ncol = 5)
darr
# Apply operations and collect
result <- darr |> d_map(~ .x * 2) |> collect()
result
# Clean up
unlink(tf)
}