nathaneastwood / poorman

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

Select helpers fail with column names containing `/` #105

Closed etiennebacher closed 2 years ago

etiennebacher commented 2 years ago

Describe the bug Using select helpers like everything() doesn't work when column names are unusual, e.g when they contain /.

To Reproduce

test <- data.frame(
  `a/b` = 1,
  check.names = FALSE
)

# work
dplyr::select(test, dplyr::everything())
#>   a/b
#> 1   1
poorman::select(test, `a/b`)
#>   a/b
#> 1   1

# doesn't work
poorman::select(test, poorman::everything())
#> Error in switch(type, `:` = select_seq(x), `!` = select_negate(x), `-` = select_minus(x), : EXPR must be a length 1 vector

Created on 2022-08-02 by the reprex package (v2.0.1)

Expected behavior Should be able to select those columns containing unusual characters.

System Information: Please detail the following information

Additional context /

nathaneastwood commented 2 years ago

Interestingly, this is because of the use of poorman:: since this works:

library(poorman)
test <- data.frame(
  `a/b` = 1,
  check.names = FALSE
)
select(test, everything())
#   a/b
# 1   1