Option for eval_select(allow_positional = FALSE)
#363
Labels
feature
a feature request or enhancement
eval_select(allow_positional = FALSE)
#363
It would be nice if we had a way to disallow positional tidyselection entirely in some cases.
For example, in tidyr here tidyverse/tidyr#1541 (comment), we remove columns generated from
names_from
andvalues_from
before evaluating theid_cols
tidyselection to prevent the user from selecting an ID column that collides with the pivot columns. This works quite well unless you use positions inid_cols
, in which case the positions you supply don't align with the data frame it is actually evaluated on.We don't think
id_cols
is a great place to be providing positions anyways, so we'd like to completely turn off the ability to use positional selection here.We think
allow_positional = FALSE
would affect a few places:all_of()
andany_of()
technically allow positional inputs, so we'd need apeek_positional()
helper like we have forpeek_vars()
to dynamically determine if we should disallow them therelast_col()
works by position and has the potential to be quite confusing if used as anid_cols
, so it should probably be completely disallowed. It would also needpeek_positional()
.walk_data_tree()
we'd check for aliteral
that is a numeric value and error whenallow_positional = FALSE
. Hopefully that catches all cases that aren't selection helpers, because everything recurses through here. Even1:5
, which doeseval_colon()
and recurses throughwalk_data_tree()
with the LHS and RHS.The text was updated successfully, but these errors were encountered: