Generate filters definition based on the Source data
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: PFUUH1655973313980
#> Filter Type: range
#> Filter Parameters:
#> dataset: iris
#> variable: Sepal.Length
#> range: NA
#> keep_na: TRUE
#> description:
#> active: TRUE
#> -> Filter ID: QJLCH1655973313980
#> Filter Type: range
#> Filter Parameters:
#> dataset: iris
#> variable: Sepal.Width
#> range: NA
#> keep_na: TRUE
#> description:
#> active: TRUE
#> -> Filter ID: PUCBE1655973313980
#> Filter Type: range
#> Filter Parameters:
#> dataset: iris
#> variable: Petal.Length
#> range: NA
#> keep_na: TRUE
#> description:
#> active: TRUE
#> -> Filter ID: SOGRZ1655973313980
#> Filter Type: range
#> Filter Parameters:
#> dataset: iris
#> variable: Petal.Width
#> range: NA
#> keep_na: TRUE
#> description:
#> active: TRUE
#> -> Filter ID: WCLBR1655973313982
#> 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)
}