pointblank
pointblank copied to clipboard
`ends_with()` doesn't work with `expect_col_exists()`
Prework
- [x] Read and agree to the code of conduct and contributing guidelines.
- [x] If there is already a relevant issue, whether open or closed, comment on the existing thread instead of posting a new issue.
- [x] Post a minimal reproducible example so the maintainer can troubleshoot the problems you identify. A reproducible example is:
- [x] Runnable: post enough R code and data so any onlooker can create the error on their own computer.
- [x] Minimal: reduce runtime wherever possible and remove complicated details that are irrelevant to the issue at hand.
- [x] Readable: format your code according to the tidyverse style guide.
Description
Using ends_with() throws an error message inside expect_col_exists() and col_exists().
Reproducible example
- [x] Post a minimal reproducible example so the maintainer can troubleshoot the problems you identify. A reproducible example is:
- [x] Runnable: post enough R code and data so any onlooker can create the error on their own computer.
- [x] Minimal: reduce runtime wherever possible and remove complicated details that are irrelevant to the issue at hand.
- [x] Readable: format your code according to the tidyverse style guide.
library(pointblank)
df <- tibble::tibble(
id.x = 1:3,
id.y = 1:3,
stuff = 1:3
)
df |>
expect_col_exists(
columns = vars(ends_with(".x"))
)
#> Error in vapply(columns, FUN.VALUE = character(1), USE.NAMES = FALSE, : values must be length 1,
#> but FUN(X[[1]]) result is length 2
df |>
col_exists(
columns = vars(ends_with(".x"))
)
#> Error in vapply(columns, FUN.VALUE = character(1), USE.NAMES = FALSE, : values must be length 1,
#> but FUN(X[[1]]) result is length 2
Created on 2022-09-22 with reprex v2.0.2
Expected result
This should run without error — tidyselect helpers should work with expect_col_exists() and col_exists().
Session info
sessionInfo()
#> R version 4.2.1 (2022-06-23)
#> Platform: x86_64-apple-darwin17.0 (64-bit)
#> Running under: macOS Big Sur ... 10.16
#>
#> Matrix products: default
#> BLAS: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRblas.0.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib
#>
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/de_DE.UTF-8/en_US.UTF-8
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] pointblank_0.11.1
#>
#> loaded via a namespace (and not attached):
#> [1] pillar_1.8.1 compiler_4.2.1 highr_0.9 R.methodsS3_1.8.2
#> [5] R.utils_2.12.0 tools_4.2.1 digest_0.6.29 evaluate_0.16
#> [9] lifecycle_1.0.1 tibble_3.1.8 R.cache_0.16.0 pkgconfig_2.0.3
#> [13] rlang_1.0.5 reprex_2.0.2 DBI_1.1.3 cli_3.3.0
#> [17] rstudioapi_0.14 yaml_2.3.5 xfun_0.32 fastmap_1.1.0
#> [21] withr_2.5.0 styler_1.7.0 stringr_1.4.1 dplyr_1.0.10
#> [25] knitr_1.40 generics_0.1.3 fs_1.5.2 vctrs_0.4.1
#> [29] tidyselect_1.1.2 glue_1.6.2 R6_2.5.1 fansi_1.0.3
#> [33] rmarkdown_2.16 blastula_0.3.2 purrr_0.3.4 magrittr_2.0.3
#> [37] htmltools_0.5.3 assertthat_0.2.1 utf8_1.2.2 stringi_1.7.8
#> [41] R.oo_1.25.0