nathaneastwood / poorman

A poor man's dependency free grammar of data manipulation
https://nathaneastwood.github.io/poorman/
Other
340 stars 15 forks source link

Renaming of multiple columns in `select()` when using `select_positions()` #24

Closed nathaneastwood closed 4 years ago

nathaneastwood commented 4 years ago

For example

mtcars %>% select(tmp = mpg:cyl)
#                      tmp tmp
# Mazda RX4           21.0   6
# Mazda RX4 Wag       21.0   6

Should have

mtcars %>% select(tmp = mpg:cyl)
#                      tmp1 tmp2
# Mazda RX4            21.0    6
# Mazda RX4 Wag        21.0    6
nathaneastwood commented 4 years ago

Also

mtcars %>% select(tmp = -mpg) # same as select(tmp = -1) etc.                                                                                                                                 
#                     tmp   tmp tmp  tmp   tmp   tmp tmp tmp tmp tmp
# Mazda RX4             6 160.0 110 3.90 2.620 16.46   0   1   4   4
# Mazda RX4 Wag         6 160.0 110 3.90 2.875 17.02   0   1   4   4