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
I happened to use a variable 'matches', and it gave this tricky to understand error from function name clash within the tidyselect package.
Doesn't have to be 'matches'; also tested with 'contains'.
Using a variable name of a function outside of tidyselect package seems to be fine (e.g. 'hasName').
Expected behaviour would be to detect the user has a variable in calling environment and point to that instead of function in package.
reprex:
my_select<- \(x, expr) tidyselect::eval_select(rlang::enquo(expr), x)
df<-data.frame(name="foo", value="bar")
matches<- c("name")
will_error<- my_select(df, tidyselect::any_of(matches))
#> Error in `my_select()`:#> ℹ In argument: `tidyselect::any_of(matches)`.#> Caused by error in `tidyselect::any_of()`:#> ! Can't subset elements.#> ✖ Subscript must be numeric or character, not a function.version$version.string#> [1] "R version 4.3.2 (2023-10-31 ucrt)"
packageVersion("tidyselect")
#> [1] '1.2.1'
packageVersion("rlang")
#> [1] '1.1.4'
The text was updated successfully, but these errors were encountered:
I happened to use a variable 'matches', and it gave this tricky to understand error from function name clash within the tidyselect package.
Doesn't have to be 'matches'; also tested with 'contains'.
Using a variable name of a function outside of tidyselect package seems to be fine (e.g. 'hasName').
Expected behaviour would be to detect the user has a variable in calling environment and point to that instead of function in package.
reprex:
The text was updated successfully, but these errors were encountered: