Generate filters definition based on the Source data
Source:R/source.R
, R/source_tblist.R
autofilter.Rd
The method should analyze source data structure, generate proper filters based on the data (e.g. column types) and attach them to source.
Arguments
- source
Source object.
- attach_as
Choose whether the filters should be attached as a new step, or list of available filters (used in filtering panel when `new_step = "configure"`). By default in
step
.- ...
Extra arguments passed to a specific method.
Examples
library(magrittr)
library(cohortBuilder)
#>
#> Attaching package: ‘cohortBuilder’
#> The following objects are masked from ‘package:stats’:
#>
#> filter, step
library(shinyCohortBuilder)
iris_source <- set_source(tblist(iris = iris)) %>%
autofilter()
iris_cohort <- cohort(iris_source)
sum_up(iris_cohort)
#> >> Step ID: 1
#> -> Filter ID: MWLEF1727431139388
#> Filter Type: range
#> Filter Parameters:
#> dataset: iris
#> variable: Sepal.Length
#> range: NA
#> keep_na: TRUE
#> description:
#> active: TRUE
#> -> Filter ID: OODFI1727431139388
#> Filter Type: range
#> Filter Parameters:
#> dataset: iris
#> variable: Sepal.Width
#> range: NA
#> keep_na: TRUE
#> description:
#> active: TRUE
#> -> Filter ID: EEXOM1727431139389
#> Filter Type: range
#> Filter Parameters:
#> dataset: iris
#> variable: Petal.Length
#> range: NA
#> keep_na: TRUE
#> description:
#> active: TRUE
#> -> Filter ID: BWKKE1727431139389
#> Filter Type: range
#> Filter Parameters:
#> dataset: iris
#> variable: Petal.Width
#> range: NA
#> keep_na: TRUE
#> description:
#> active: TRUE
#> -> Filter ID: ULBFD1727431139390
#> Filter Type: discrete
#> Filter Parameters:
#> dataset: iris
#> variable: Species
#> value: NA
#> keep_na: TRUE
#> description:
#> active: TRUE
if (interactive()) {
library(shiny)
ui <- fluidPage(
cb_ui("mycoh")
)
server <- function(input, output, session) {
cb_server("mycoh", cohort = iris_cohort)
}
shinyApp(ui, server)
}