You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recently on Twitter there was a discussion about a tidy way of removing vector elements given their names (this tweet in particular).
I suggested modify_at(x, names_to_remove, ~NULL), but it failed to work with multiple elements (thanks to this tweet from EFromTheWest user):
This seems to be because internally modify_at() uses modify_if(), which in turn is implemented with iterative modification based on integer indexes (see these lines). This approach fails to work if elements are removed as a result of modification.
This issue is created to notify about this possible confusion and, probably, for you to consider supporting this behavior.
The text was updated successfully, but these errors were encountered:
We could support this via rlang::zap(). However I'm not sure that we should allow the result of modify_ functions to have a different size than the output.
Recently on Twitter there was a discussion about a tidy way of removing vector elements given their names (this tweet in particular).
I suggested
modify_at(x, names_to_remove, ~NULL)
, but it failed to work with multiple elements (thanks to this tweet from EFromTheWest user):Created on 2019-10-26 by the reprex package (v0.3.0)
This seems to be because internally
modify_at()
usesmodify_if()
, which in turn is implemented with iterative modification based on integer indexes (see these lines). This approach fails to work if elements are removed as a result of modification.This issue is created to notify about this possible confusion and, probably, for you to consider supporting this behavior.
The text was updated successfully, but these errors were encountered: