Modify a vector with some function

vec_mutate(.x, .f = identity, .p = vec_all_true)

Arguments

.x

A vector.

.f

A function to apply in .x or a vector of the same length as .x.

.p

A single predicate function or a logical vector of the same length as .x. Only those elements where .p evaluates to TRUE will be modified.

Value

The vector .x with possibly some entries modified by .f.