Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should vars_rename() accept index numbers? #20

Closed
yutannihilation opened this issue Jul 28, 2017 · 1 comment
Closed

Should vars_rename() accept index numbers? #20

yutannihilation opened this issue Jul 28, 2017 · 1 comment

Comments

@yutannihilation
Copy link
Contributor

@yutannihilation yutannihilation commented Jul 28, 2017

I feel this behavior a bit inconsistent, as select() and rename() shares the same semantics to some extent.

vars_select(names(mtcars), new = 1)
#>   new 
#> "mpg" 
vars_rename(names(mtcars), new = 1)
#> Error: `new` = 1 must be a symbol or a string, not a double vector

For example, they both accept characters. Are there any reason to prevent rename from accepting numbers? (This is not a big problem for me, though. This issue is mostly for my curiosity).

vars_rename(names(mtcars), new = "cyl")
#>    mpg    new   disp     hp   drat     wt   qsec     vs     am   gear   carb 
#>  "mpg"  "cyl" "disp"   "hp" "drat"   "wt" "qsec"   "vs"   "am" "gear" "carb" 
vars_select(names(mtcars), new = "cyl")
#>   new 
#>  "cyl"
lionel- added a commit to lionel-/tidyselect that referenced this issue Aug 22, 2017
lionel- added a commit to lionel-/tidyselect that referenced this issue Aug 23, 2017
@yutannihilation
Copy link
Contributor Author

@yutannihilation yutannihilation commented Aug 23, 2017

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant