Elements failing the predicate are replaced with fill at materialisation
time.
Examples
mat <- matrix(c(-1, 2, -3, 4, -5, 6), nrow = 2, ncol = 3)
darr <- delarr(mat)
# Replace negative values with 0
masked <- darr |> d_where(~ .x >= 0, fill = 0) |> collect()
masked
#> [,1] [,2] [,3]
#> [1,] 0 0 0
#> [2,] 2 4 6
# Replace values below threshold with NA
filtered <- darr |> d_where(~ .x > 1, fill = NA) |> collect()
filtered
#> [,1] [,2] [,3]
#> [1,] NA NA NA
#> [2,] 2 4 6