Package: cohortBuilder 1.0.0

Krystian Igras

cohortBuilder: Data Source Agnostic Filtering Tools

Common API for filtering data stored in different data models. Provides multiple filter types and reproducible R code. Works standalone or with 'shinyCohortBuilder' as the GUI for interactive Shiny apps.

Authors:Krystian Igras [cre, aut], Adam Foryś [ctb]

cohortBuilder_1.0.0.tar.gz
cohortBuilder_1.0.0.zip(r-4.7)cohortBuilder_1.0.0.zip(r-4.6)cohortBuilder_1.0.0.zip(r-4.5)
cohortBuilder_1.0.0.tgz(r-4.6-any)cohortBuilder_1.0.0.tgz(r-4.5-any)
cohortBuilder_1.0.0.tar.gz(r-4.7-any)cohortBuilder_1.0.0.tar.gz(r-4.6-any)
cohortBuilder_1.0.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html
DESCRIPTION |NEWS
card.svg |card.png
cohortBuilder/json (API)

# Install 'cohortBuilder' in R:
install.packages('cohortBuilder', repos = c('https://r-world-devs.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/r-world-devs/cohortbuilder/issues

Pkgdown/docs site:https://r-world-devs.github.io

Datasets:

On CRAN:

Conda:

7.58 score 9 stars 1 packages 50 scripts 274 downloads 89 exports 33 dependencies

Last updated from:d626a7036f. Checks:9 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-x86_64OK171
source / vignettesOK203
linux-release-x86_64OK155
macos-release-arm64OK192
macos-oldrel-arm64OK135
windows-develOK121
windows-releaseOK109
windows-oldrelOK138
wasm-releaseOK155

Exports:.collect_data.gen_id.get_attrition_count.get_attrition_label.get_item.get_method.get_stats.if_value.init_step.post_binding.post_filtering.pre_filtering.print_filter.propagate_domains.repro_code_tweak.run_binding%->%add_filteradd_hookadd_sourceadd_stepas.tblistattritionautofilterbind_keybind_keyscb_domain_from_datacb_domain_from_statscb_filter_datacb_filter_to_exprcb_get_filter_datacb_get_filter_defaultscb_get_filter_statscb_intersect_domaincb_intersect_domain_valuescb_plot_filter_datacb_register_toolcb_register_toolscb_toolcb_tool_add_filterscb_tool_apply_filterscb_tool_clear_filterscb_tool_describe_statecb_tool_filters_metacb_tool_get_codecb_tool_get_data_summarycb_tool_remove_filterscb_tool_remove_stepcb_tool_runcb_tool_set_filter_valuescb_tool_toggle_filtersCbFilterCbFilterDateRangeCbFilterDatetimeRangeCbFilterDiscreteCbFilterDiscreteTextCbFilterMultiDiscreteCbFilterQueryCbFilterRangecodecohortdata_keydescribedescriptionfilterfilter_domainfilter_effective_valuefilter_variablesget_dataget_filter_paramsget_hookget_stateplot_dataprimary_keysregister_filter_typerestorerm_filterrm_steprunset_sourceshapeSourcestatstepsum_uptblisttblist_classupdate_filterupdate_source

Dependencies:clicollapsecpp11dplyrfarverformatRgenericsggplot2gluegtableisobandjsonlitelabelinglifecyclemagrittrpillarpkgconfigpurrrR6RColorBrewerRcpprlangS7scalesstringistringrtibbletidyrtidyselectutf8vctrsviridisLitewithr

Implementing custom filters
Filter architecture | Built-in filter example | Creating a custom filter: logical filter | Step 1: Define the S7 filter class | Step 2: Register the filter type | Step 3: Implement methods for tblist source | filter_data -- filtering logic | get_stats -- data statistics | plot_data -- visualization | get_data -- filter-related data | get_defaults -- default parameter values | filter_to_expr -- reproducible code | Using the filter | Extra parameters | Implementing filters in a package

Last update: 2026-07-02
Started: 2022-05-22

Introduction to cohortBuilder
cohortBuilder vs. dplyr | Data: librarian | Source object | Cohort object | Configuring and running filters | Multi-stage filtering | Exploring the Cohort object methods | Learning more about the source data | Sharing code and reproducibility

Last update: 2026-07-02
Started: 2022-05-22

Managing Cohort Object
Managing filters | Managing steps | Managing source | Statistics and domain propagation | compute_stats | propagate_domains

Last update: 2026-07-02
Started: 2022-05-22

Source intelligence and AI tools
Describing a source | Generating filters automatically | Inspecting a source with shape() | Connecting a cohort to an LLM

Last update: 2026-07-02
Started: 2026-07-02

Specifying data relations with Binding Keys
Classic approach | Binding Keys

Last update: 2026-07-02
Started: 2022-05-22

Variants for Cohort Configuration
Filtering steps in Source | Filtering steps in Cohort

Last update: 2026-07-02
Started: 2022-05-22

Writing custom extensions

Last update: 2026-07-02
Started: 2022-05-22

Readme and manuals

Help Manual

Help pageTopics
Create data source cohortcohortBuilder-package
Generate random ID.gen_id
Return list of objects matching provided condition..get_item
Get function definition.get_method
Return default value if values are equal.if_value
Method for printing filter details.print_filter .print_filter.default
Propagate domains between steps.propagate_domains .propagate_domains.default .propagate_domains.tblist
Operator simplifying adding steps or filters to Cohort and Source objects%->%
Add filter definitionadd_filter add_filter.Cohort add_filter.Source
Add source to Cohort object.add_source
Add filtering step definitionadd_step add_step.Cohort add_step.Source
Show attrition plot.attrition
Generate filters definition based on the Source dataautofilter autofilter.default autofilter.tblist
Describe data relations with binding keysbinding-keys bind_key bind_keys
Extract domain from datacb_domain_from_data
Extract domain from stored filter statisticscb_domain_from_stats
Apply filter to data objectcb_filter_data
Generate reproducible code expression for filtercb_filter_to_expr
Get filter-related datacb_get_filter_data
Get filter default valuescb_get_filter_defaults
Get filter statisticscb_get_filter_stats
Get effective filter value after domain intersectioncb_intersect_domain
Intersect two domain values for a filter typecb_intersect_domain_values
Plot filter datacb_plot_filter_data
Register cohortBuilder tools with an ellmer chatcb_register_tool cb_register_tools
Create a cohortBuilder tool definitioncb_tool print.cb_tool
Create a tool for adding filters to a cohortcb_tool_add_filters
Create a tool that adds filters and sets their values in one callcb_tool_apply_filters
Create a tool for resetting filters to defaultscb_tool_clear_filters
Create a tool returning the current cohort statecb_tool_describe_state
Create a tool returning available filters metadatacb_tool_filters_meta
Create a tool returning reproducible filtering codecb_tool_get_code
Create a tool returning row counts per dataset and stepcb_tool_get_data_summary
Create a tool for removing filters from the cohortcb_tool_remove_filters
Create a tool for removing the last stepcb_tool_remove_step
Create a tool for running the cohort pipelinecb_tool_run
Create a tool for setting filter valuescb_tool_set_filter_values
Create a tool for activating or deactivating filterscb_tool_toggle_filters
Base class for all cohortBuilder filtersCbFilter
Date range filter classCbFilterDateRange
Datetime range filter classCbFilterDatetimeRange
Discrete filter classCbFilterDiscrete
Discrete text filter classCbFilterDiscreteText
Multi-discrete filter classCbFilterMultiDiscrete
Query filter classCbFilterQuery
Range filter classCbFilterRange
Return reproducible data filtering code.code
R6 class representing Cohort object.Cohort
Cohort related methodscohort-methods
Create new 'Cohort' objectcohort create-cohort
Define Source dataset keydata_key
Create a description objectdescribe
Show source data or filter descriptiondescription
Define Cohort filterfilter
Get a filter's domainfilter_domain
Get a filter's effective valuefilter_effective_value
Get the variables a filter operates onfilter_variables
Get step related dataget_data
Get filter parameters as a listget_filter_params
Get Cohort configuration state.get_state
Cohort hooks.add_hook get_hook hooks
Sample of library databaselibrarian
Managing the Cohort objectmanaging-cohort
Managing the Source objectmanaging-source
Plot filter related Cohort data.plot_data
Define Source datasets primary keysprimary_keys
Register a custom filter typeregister_filter_type
Restore Cohort object.restore
Remove filter definitionrm_filter rm_filter.Cohort rm_filter.Source
Remove filtering step definitionrm_step rm_step.Cohort rm_step.Source
Trigger data calculations.run
Create Cohort sourceset_source set_source.tblist
Describe the structure of a sourceshape shape.default shape.tblist
R6 class representing a data sourceSource
Source compatibility methods..collect_data .collect_data.default .collect_data.tblist .get_attrition_count .get_attrition_count.default .get_attrition_label .get_attrition_label.default .get_stats .get_stats.default .get_stats.tblist .init_step .init_step.default .init_step.tblist .post_binding .post_binding.default .post_filtering .post_filtering.default .pre_filtering .pre_filtering.default .repro_code_tweak .run_binding .run_binding.default source-layer
Get Cohort related statistics.stat
Create filtering stepstep
Sum up Cohort state.sum_up
Create in memory tables connectionas.tblist tblist
S7 class wrapper for the `tblist` sourcetblist_class
Update filter definitionupdate_filter update_filter.Cohort update_filter.Source
Update source in Cohort object.update_source