We can have a where argument, and we'd mutate on these positions only. .subset will contain the filtered data and .data the unfiltered one. And the default would be to consider the filtered ones as it's faster and makes generally no difference, but we keep the flexibility.
We could propose a syntax similar to the along formula syntax but when doing by variable ifelse is good enough, especially with dot notation : foo[col = ifelse(is.na(.), "!", .)]
where should accept the same kind of input as i, appart from ++ rbinding.
where
We can have a
where
argument, and we'd mutate on these positions only. .subset will contain the filtered data and .data the unfiltered one. And the default would be to consider the filtered ones as it's faster and makes generally no difference, but we keep the flexibility.We could propose a syntax similar to the along formula syntax but when doing by variable
ifelse
is good enough, especially with dot notation :foo[col = ifelse(is.na(.), "!", .)]
where
should accept the same kind of input asi
, appart from++
rbinding.Relevant : https://stackoverflow.com/questions/24459752/can-dplyr-package-be-used-for-conditional-mutating
if
Nothing stops us from implementing this :
That what
purrr::when()
and my ownpif()
are designed for but this would be much easier this way.We could be as general as in standard mutate call, so support renaming and other advanced features, should work in
s()
too.