d_map2: Apply a binary elementwise transformation lazily

View source: R/delarr-verbs.R

d_map2R Documentation

Apply a binary elementwise transformation lazily

Description

Apply a binary elementwise transformation lazily

Usage

d_map2(x, y, f)

Arguments

x

A delarr.

y

Another delarr, matrix, or numeric vector/scalar.

f

A function or formula combining two arguments.

Value

A delarr representing the fused binary operation.

Examples

mat1 <- matrix(1:12, nrow = 3, ncol = 4)
mat2 <- matrix(12:1, nrow = 3, ncol = 4)
darr1 <- delarr(mat1)
darr2 <- delarr(mat2)

# Binary operation between two delayed matrices
added <- d_map2(darr1, darr2, ~ .x + .y) |> collect()
added

# Binary operation with scalar
scaled <- d_map2(darr1, 10, ~ .x * .y) |> collect()
scaled


delarr documentation built on July 1, 2026, 1:06 a.m.