CDU-data-science-team / pxtextminingdashboard

Text mining and visualization of NHS patient feedback.
https://feedbackmatters.uk/rsconnect/text_mining_dashboard/
Other
4 stars 1 forks source link

Passing arguments from module to util functions #13

Closed andreassot10 closed 3 years ago

andreassot10 commented 3 years ago

This line:

https://github.com/CDU-data-science-team/positiveAboutChangeTextClassificationDashboard/blob/e59955d6e57cd44bbec11c203ca8f56e0f1f4761/R/mod_bigrams_network_utils_bigrams.R#L9

Causes the following error:

Warning: Error in : Problem with `filter()` input `..1`.
x 
i Input `..1` is `dplyr::across(dplyr::all_of(y), ~. %in% label)`.
  198: <Anonymous>

although I did pass reactive elements into req()::

https://github.com/CDU-data-science-team/positiveAboutChangeTextClassificationDashboard/blob/e59955d6e57cd44bbec11c203ca8f56e0f1f4761/R/mod_bigrams_network.R#L51

The bug has no impact on the visualization itself- but it's still very annoying.

andreassot10 commented 3 years ago

I think I've misinterpreted the use of req(). At first I thought that it replaces a reactive object input$x, e.g. if the function argument is argument_a = input$x, and it doesn't work, then you'd have to rewrite as argument_a = req(input$x). But it seems like req(input$x) needs to be placed on its own right, outside the function where input$x is being passed, in order for Shiny to silence non-truthy values?

ChrisBeeley commented 3 years ago

Yes, wherever you place it nothing below that line runs until its argument is truthy