Allow selection of vectors and filters upon initialization#20
Conversation
|
@AARON-CLARK what do you think of the approach outlined in this PR? Things I like about it:
Things I don't like:
Here's a snippet to see the preselection in action: |
AARON-CLARK
left a comment
There was a problem hiding this comment.
Wow, this is cool. I love the pre-selection feature and how easy / intuitive it is to add in.
I have inserted a new argument before verbose which makes the functions not as backwards compatible as I would like. This issue feels fairly unavoidable though.
Why can't it be last? so it doesn't introduce breaking changes to users who may not be specifying the arg name with the module call?
The filtering is happening on the vector itself instead of the input (e.g. ~ .x <= 100 might result with x <= 90 if 90 is the largest number less than or equal to 100)
I don't think that's a big deal. Yes, it is slightly confusing if your a developer and you think your filtering to < 100. It's a shame the generated code doesn't reflect the filter_fn. Do you think it could some how?
The filtering is happening on the vector itself instead of the input (e.g. ~ .x <= 100 might result with x <= 90 if 90 is the largest number less than or equal to 100)
I think it's fine that variables not found in the data are "ignored" or "fail silently" as long as that message is sent to the console. Nice work!
I was playing around with the starwars example app in our inst/ folder by adding the following code:
filtered_data <- callModule(
shiny_data_filter,
"data_filter",
data = starwars2,
preselection = list(name = list(filter_na = TRUE, filter_fn = ~stringr::str_detect(.x, '[0-9]')),
eye_color = list(filter_na = TRUE, filter_fn = ~ c("yellow","red") %in% .x),
Solar.R = list()),
verbose = FALSE)I did notice that my filter on eye_color didn't really work. For some reason, it's still including "black" eye colors.
It can be last. In my mind the |
So I noticed that your filter is backwards (i.e. you have |
Not really. I was going down that route at the start, but then you have to account for the different methods. We could allow for other arguments (e.g. if a user provides a Plus since the filter has a waterfall type affect, you couldn't force the values anyways. I think the main thing is that the filtering code is meant to be reproducible on the same dataset, not across datasets. |
Merge branch 'devel' into jt-13-preselection # Conflicts: # R/shiny_vector_filter_datetime.R
Merge branch 'jt-13-preselection' of https://github.com/Biogen-Inc/IDEAFilter into jt-13-preselection # Conflicts: # DESCRIPTION




Addresses #13