shinyfilters() is a new function to configure filters. It displays an informative print and allows for configuration without extending methods directly. The functions listed here support shinyfilters objects (#111).
print() displays the current configuration and if/how any settings were applied.as.data.frame(), as_tibble(), and as.data.table() return the data.frame behind a configuration (#105).[ keeps only the selected columns of a configuration (#105).[[, and $ return the input for one column of a configuration (#105).everything() and where(), are optionally supported in [ and [[.with_filters() chooses the input for columns, and adds or replaces computed columns (#105, #111).with_args() sets the arguments of columns' inputs (#105, #134)..update_fn = fn, among an input's arguments, names the function that updates an input shinyfilters doesn't know, such as shiny::updateCheckboxGroupInput for shiny::checkboxGroupInput (#105).with_filters() gives a shinyWidgets input, such as shinyWidgets::pickerInput, its own update function, so it needs no .update_fn (#34).with_defaults() sets or removes the arguments a configuration passes to filterInput() for every column (#105).with_ns() sets or removes the namespace of a configuration (#105).shinyfilters_server() is the new name of serverFilterInput(), and also returns the filtered data, as filtered. Its input argument is deprecated: omit it, or pass session (#105).shinyfilters_server() updates the inputs of a configuration as updateFilterInput() does, and reads and updates the inputs of its namespace wherever it is called (#105).updateFilterInput() updates the inputs of a configuration, each with the function and arguments that match the input its column uses (#105).nyc_flights is a new example dataset of flights departing New York City (#36).arg_name_input_id() and arg_name_input_label() now return "inputId" and "label" for an x of any class, so with_filters() can give a column of any class a radio or select input (#111).apply_filters() now drops a row whose filtered value is missing, instead of returning a row of NAs, unless NA is one of the filter's values (#136).apply_filters() now keeps the attributes of a data frame's columns, as it does for a tibble, so serverFilterInput() updates a column of a custom class with that class's updateFilterInput() method (#136).args_update_filter_input() now leaves out start and end when range = TRUE, as it leaves out the value of every other input (#136).filterInput() now errors when x is all missing.filterInput()'s ns argument behaves like shiny::NS(), accepting any argument.get_filter_logical() now filters a datetime x by a Date val, the value of a date input, instead of keeping every element (#136).get_filter_logical() now filters an x that isn't a character, factor, or logical vector by a character val, the value of a select or radio input, instead of keeping every element (#136).serverFilterInput() now leaves a radio input with no selection unselected when it updates its choices, instead of selecting the first one (#136).get_filter_logical() now returns rep(T, length(x)) when a method is not defined. This behavior is a bandaid for the underlying issue: numericInput() returns a logical when the user blanks out the input.get_filter_logical() that caused an error when an argument was provided to apply_filters() and a categorical filter had an active selection.filterInput() (#40):
arg_name_input_id()arg_name_input_label()arg_name_input_value()args_filter_input() (#24, #56):
args_unique: pass arguments to unique()args_sort: pass arguments to sort()args_update_filter_input() can now return a value for inputId (or equivalent) ([#87])anyNA() for NA checks and inherits() for class checks, per jarl check . (@novica)args_filter_input() returns a completely unnamed listupdateFilterInput() now works when passing selected (or equivalent) as an argumentselected argument (or equivalent) is now always removed from the result of args_update_filter_input() (#90)apply_filters() were removed in serverFilterInput() (#92)inputId (#17)get_input_values() example (#18)get_input_values(): Generic to return multiple values from a shiny input object (#10, #5)get_input_ids(): Generic to return the names of the shiny input ids for an arbitrary object x. Method provided for data.frames (#12)get_input_labels(): Same as get_input_ids(), but returns the label instead of inputId (#10).get_input_values() has been re-added; its erroneous removal was causing an error in serverFilterInput() (#10, #5).args_update_filter_input() has been removed from the README's list of extensible functions.Initial release of shinyfilters.
The package provides the following functions:
filterInput(): Create a shiny input from a vector or data.frame, with support for extensionupdateFilterInput(): Update a filter input created by filterInput()serverFilterInput(): Server logic to update filter inputs for data.framesapply_filters(): Apply a list of filters to a data.frameargs_filter_input(), args_update_filter_input(): Get default args for filterInput() and updateFilterInput().call_filter_input(), call_update_filter_input(): Create calls to filterInput() and updateFilterInput().get_filter_logical(): Compute a logical vector for filtering a data.frame column