22# ' @docType class
33# '
44# '
5- # ' @title Abstract class to encapsulate filter states
5+ # ' @title FilterState Abstract Class
6+ # '
7+ # ' @description Abstract class to encapsulate filter states
68# '
79# ' @details
810# ' This class is responsible for managing single filter item within
@@ -288,7 +290,7 @@ FilterState <- R6::R6Class( # nolint
288290 # ' @param value (`vector`)\cr
289291 # ' value(s) that come from filter selection; values are set in the
290292 # ' module server after a selection is made in the app interface;
291- # ' values are stored in `private$selected`n which is reactive;
293+ # ' values are stored in `private$selected` which is reactive;
292294 # ' value types have to be the same as `private$choices`
293295 # '
294296 # ' @return NULL invisibly
@@ -430,11 +432,12 @@ FilterState <- R6::R6Class( # nolint
430432 x_reactive = NULL , # reactive containing the filtered variable, used for updating counts and histograms
431433 filtered_na_count = NULL , # reactive containing the count of NA in the filtered dataset
432434
433- # ' description
434- # ' Adds `is.na(varname)` before existing condition calls if `keep_na` is selected.
435- # ' Otherwise, if missings are found in the variable `!is.na` will be added
436- # ' only if `private$na_rm = TRUE`
437- # ' return (`call`)
435+ # private methods ----
436+ # @description
437+ # Adds `is.na(varname)` before existing condition calls if `keep_na` is selected.
438+ # Otherwise, if missings are found in the variable `!is.na` will be added
439+ # only if `private$na_rm = TRUE`
440+ # @return (`call`)
438441 add_keep_na_call = function (filter_call ) {
439442 if (isTRUE(self $ get_keep_na())) {
440443 call(
@@ -453,14 +456,14 @@ FilterState <- R6::R6Class( # nolint
453456 }
454457 },
455458
456- # ' description
457- # ' Prefixed (or not) variable
458- # '
459- # ' Return variable name needed to condition call.
460- # ' If `isTRUE(private$use_dataset)` variable is prefixed by
461- # ' dataname to be evaluated as extracted object, for example
462- # ' `data$var`
463- # ' return (`name` or `call`)
459+ # @ description
460+ # Prefixed (or not) variable
461+ #
462+ # Return variable name needed to condition call.
463+ # If `isTRUE(private$use_dataset)` variable is prefixed by
464+ # dataname to be evaluated as extracted object, for example
465+ # `data$var`
466+ # @ return (`name` or `call`)
464467 get_varname_prefixed = function () {
465468 if (isTRUE(private $ extract_type == " list" )) {
466469 call_extract_list(private $ dataname , private $ varname )
@@ -474,13 +477,20 @@ FilterState <- R6::R6Class( # nolint
474477 }
475478 },
476479
477- # ' Set choices
478- # '
479- # ' Set choices is supposed to be executed once in the constructor
480- # ' to define set/range which selection is made from.
481- # ' parameter choices (`vector`)\cr
482- # ' class of the vector depends on the `FilterState` class.
483- # ' return a `NULL`
480+
481+ # Sets `keep_na` field according to observed `input$keep_na`
482+ # If `keep_na = TRUE` `is.na(varname)` is added to the returned call.
483+ # Otherwise returned call excludes `NA` when executed.
484+ observe_keep_na = function (input ) {
485+
486+ },
487+
488+ # @description
489+ # Set choices is supposed to be executed once in the constructor
490+ # to define set/range which selection is made from.
491+ # parameter choices (`vector`)\cr
492+ # class of the vector depends on the `FilterState` class.
493+ # @return `NULL`
484494 set_choices = function (choices ) {
485495 private $ choices <- choices
486496 invisible (NULL )
@@ -528,11 +538,11 @@ FilterState <- R6::R6Class( # nolint
528538 },
529539
530540 # shiny modules -----
531- # ' module with inputs
541+ # module with inputs
532542 ui_inputs = function (id ) {
533543 stop(" abstract class" )
534544 },
535- # ' module with inputs
545+ # module with inputs
536546 server_inputs = function (id ) {
537547 stop(" abstract class" )
538548 },
@@ -589,7 +599,7 @@ FilterState <- R6::R6Class( # nolint
589599 }
590600 )
591601 private $ observers $ keep_na <- observeEvent(
592- ignoreNULL = FALSE , # ignoreNULL: we don't want to ignore NULL when nothing is selected in the `selectInput`,
602+ ignoreNULL = FALSE , # ignoreNULL: we don't want to ignore NULL when nothing is selected in the `selectInput`
593603 ignoreInit = TRUE , # ignoreInit: should not matter because we set the UI with the desired initial state
594604 eventExpr = input $ value ,
595605 handlerExpr = {
0 commit comments