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

Support tidyselect #447

Closed
vRadAdamBender opened this issue Sep 11, 2023 · 1 comment
Closed

Support tidyselect #447

vRadAdamBender opened this issue Sep 11, 2023 · 1 comment

Comments

@vRadAdamBender
Copy link

With dtplyr not all tidyselect verbs are supported. Can this be implemented?

Error in across():
! This tidyselect interface doesn't support predicates.
Backtrace:

@markfairbanks
Copy link
Collaborator

markfairbanks commented Sep 11, 2023

where() doesn't work with dtplyr (or dbplyr) since they work lazily. This means columns don't necessarily exist until collect() is called. Unfortunately there's no way to add this functionality, either, hence the error message ! This tidyselect interface doesn't support predicates.

It's also worth noting that other tidyselect functions work just fine - starts_with(), ends_with(), etc.

library(dtplyr)
library(dplyr, warn.conflicts = FALSE)

iris %>%
  lazy_dt() %>%
  select(starts_with("S"))
#> Source: local data table [150 x 3]
#> Call:   `_DT1`[, .(Sepal.Length, Sepal.Width, Species)]
#> 
#>   Sepal.Length Sepal.Width Species
#>          <dbl>       <dbl> <fct>  
#> 1          5.1         3.5 setosa 
#> 2          4.9         3   setosa 
#> 3          4.7         3.2 setosa 
#> 4          4.6         3.1 setosa 
#> 5          5           3.6 setosa 
#> 6          5.4         3.9 setosa 
#> # ℹ 144 more rows
#> 
#> # Use as.data.table()/as.data.frame()/as_tibble() to access results

Hope this helps! If you have any questions let me know.

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

2 participants