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

(feature request) #31

Open
SimonCoulombe opened this issue Jun 7, 2024 · 3 comments
Open

(feature request) #31

SimonCoulombe opened this issue Jun 7, 2024 · 3 comments

Comments

@SimonCoulombe
Copy link

hello!
I was wondering if it would be possible to modify this script to accomodate filtering tables in databases that we lazy load using {dbplyr}?

I have just spend a couple days trying to decipher the code in shinyDataFilter. I made some progress (mostly involving replacing nrows() with tally() and , but I dont think it is possible in its current form:

My understanding is that vector_module_return()$mask() returns a vector of TRUE/FALSE to tell us which row numbers to keep. Thing is, SQL doesnt have a concept of row number as order of rows is always random.

I was hoping to replace the line
out_data <- subset(data(), vector_module_return()$mask()) in shiny_data_filter_item with some code that would apply the code in vector_module_return()$code() directly to data(), but I'm out of my skill level.

@jthompson-arcus
Copy link
Collaborator

The use of shiny_data_filter() and shiny_data_filter_item() are being deprecated. Does IDEAFilter() and IDEAFilter_item() still possess the same problem for you? There were changes made specifically relating to the data object passed into the function, but I do believe even there the filtering is ultimately based on a vector of TRUE/FALSE.

@SimonCoulombe
Copy link
Author

woah that was quick, let me give this a try!
meanwhile, I spent my afternoon working on this pull request on shinyDataFilter that kinda works for me:
dgkf/shinyDataFilter#26

@SimonCoulombe
Copy link
Author

SimonCoulombe commented Jun 7, 2024

just gave IDEAFilter a quick test and it doesnt work with a lazy loaded table from dbplyr..

how I tested:

library(dbplyr) 
library(DBI)
starwars2_sql <- tbl_memdb(starwars2)

then I replaced starwars2 by starwars2_sql in two places in the example app:
varSelectizeInput("col_subset", "Choose Column Subset", starwars2_sql, multiple = TRUE),

filtered_data <- IDEAFilter("data_filter", data = starwars2_sql, col_subset = reactive(input$col_subset), preselection = preselection, verbose = FALSE)

Trying the app with these changes returns the error "Error in rep: argument 'times' incorrect", which is the first error I would get in shinyDataFilter before implementing my changes in my pull request above.

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