diff --git a/README.md b/README.md index 2df5ade..c599f9e 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,13 @@ Define some validation rules with package [validate](https://github.com/data-cle ![](man/figures/datamods-validation.png) +### Filter + +Interactively filter a `data.frame`, this module also generates the code to reproduce the filters. + +![](man/figures/datamods-filter.png) + + ## Final Notes : - Please find example apps of each of the modules in the `/examples` folder. diff --git a/man/figures/datamods-filter.png b/man/figures/datamods-filter.png new file mode 100644 index 0000000..e2ee29a Binary files /dev/null and b/man/figures/datamods-filter.png differ diff --git a/vignettes/datamods.Rmd b/vignettes/datamods.Rmd index 1e3719c..4504151 100644 --- a/vignettes/datamods.Rmd +++ b/vignettes/datamods.Rmd @@ -233,4 +233,35 @@ The return value server-side is a list with the following items: * **details**: a reactive function returning a list with validation details. +### Filter + +Interactively filter a `data.frame` and generate code to reproduce filters applied: + +```{r} +# UI +filter_data_ui("filtering", max_height = "500px") + +# Server +res_filter <- filter_data_server( + id = "filtering", + data = reactive(mtcars), + name = reactive("mtcars"), + vars = reactive(names(mtcars)), + widget_num = "slider", + widget_date = "slider", + label_na = "Missing" +) +``` + +You can select variables for which to create a filter and choose widgets used to create the UI filter. + + + +The return value server-side is a list with the following items: + +* **filtered**: a `reactive` function returning the data filtered. +* **code**: a `reactive` function returning the dplyr pipeline to filter data. +* **expr**: a `reactive` function returning an expression to filter data. + + diff --git a/vignettes/figures/datamods-filter-2.png b/vignettes/figures/datamods-filter-2.png new file mode 100644 index 0000000..44f4c71 Binary files /dev/null and b/vignettes/figures/datamods-filter-2.png differ