| d_where | R Documentation |
Elements failing the predicate are replaced with fill at materialisation
time.
d_where(x, predicate, fill = 0)
x |
A |
predicate |
A function or formula returning a logical matrix. |
fill |
Replacement value for elements where the predicate is |
A delarr including the mask.
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
# Replace values below threshold with NA
filtered <- darr |> d_where(~ .x > 1, fill = NA) |> collect()
filtered
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.