Skip to content

cohortBuilder

1.0.0Package record

Data Source Agnostic Filtering Tools

1packages depend
3.6Kdownloads / year
86.3%test coverage
13/13flavors OK

Overview

About

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.

Changes in 1.0.0

Breaking changes

  • **Filter system rewritten to S7.** Filters are now S7 objects (e.g. CbFilterDiscrete, CbFilterRange) with dual dispatch on (filter_class, source_class). Properties are accessed via @ instead of closure environments. New S7 generics: cb_filter_data(), cb_get_filter_stats(), cb_plot_filter_data(), cb_get_filter_data(), cb_get_filter_defaults(), cb_filter_to_expr().
  • Removed def_filter(), new_filter(), and .as_constructor() — replaced by S7 constructors.
  • Switched from magrittr %>% to native pipe |>. Requires R >= 4.1.0.
  • Renamed the cohort statistics store and its API for clarity: the Cohort$new() cache argument is now compute_stats, the propagate_domains mode "cache" is now "stats", and the get_cache()/update_cache() methods are now get_stats()/update_stats(). The previous live-computation method Cohort$get_stats() (used by stat()) is now calc_stats().

New features

Show all changes in 1.0.0Hide the rest of the changes in 1.0.0
  • Custom filter types can now be registered via register_filter_type(), enabling extensions without modifying core package code.
  • New describe() helper to attach metadata (descriptions) to datasets and filters. describe() also accepts a label argument; when set on a variable, autofilter() reuses it as the generated filter's name.
  • shape() filter entries now include a name field, and the description field combines the filter- and variable-level descriptions.
  • New shape() generic extracts structured filter/dataset metadata from a source, including statistics (min/max for range, choices for discrete).
  • New autofilter() generic auto-generates filters based on column types (character/factor → discrete, numeric → range, Date → date_range, POSIXct → datetime_range). Supports attach_as = "step" (add as filtering step) or attach_as = "meta" (store as available filters).
  • New .class parameter in tblist() to prepend custom S3 classes for method dispatch customization.
  • Steps now track pending status — only pending steps trigger statistics recalculation, improving performance for multi-step workflows.
  • update_filter() now supports pre/post hooks via hook_args.
  • New Cohort$new() propagate_domains argument controls how filter domains are narrowed between steps: "none" (default), "filter" (from previous step filter values), "stats" (from stored statistics; requires compute_stats = TRUE), or "data" (scan filtered data; the stats-free equivalent). Backed by the .propagate_domains() source method and the S7 generics cb_intersect_domain(), cb_intersect_domain_values(), cb_domain_from_stats(), and cb_domain_from_data(). Filter values are now intersected against their domain (with trimming messages) before filtering.
  • set_source() gains a compute_meta_stats argument (default from the cb.source_filters_meta_stats option) controlling whether metadata statistics for available_filters are pre-computed; when FALSE, filter domains fall back to live computation. Sources also accept an available_filters definition directly.
  • Filter ids are now deterministic by default (derived from dataset and variable names), enabling cross-step filter matching for domain propagation. Override with explicit id =.

AI/LLM integration

  • New cb_tool() system for defining LLM-compatible tool specifications (requires ellmer).
  • Built-in tools: cb_tool_filters_meta(), cb_tool_add_filters(), cb_tool_set_filter_values(), cb_tool_apply_filters() (combined add + set values).
  • cb_register_tool() and cb_register_tools() register tools with an ellmer chat object.
  • AI tool invocations can be traced by setting options(cb_tool_verbose = TRUE), which logs the invoked tool and its arguments via message(). Logging is off by default (replaces earlier unconditional print() debug output).

Improvements

  • Use collapse for binding operations (joins), with verbose option for diagnostics.
  • Reorganized breaks argument for date_range filter plots.
  • Extensive test coverage improvements including vdiffr snapshot tests for all filter plot types.
  • cohort() now exposes the compute_stats and propagate_domains arguments, and add_filter()/rm_filter() now expose and forward the hook argument (previously these were silently ignored).
  • Comprehensive roxygen documentation added across exported and internal functions, plus a new source-intelligence vignette covering describe(), autofilter(), shape(), and the AI/LLM tools.

From NEWS.md in the release

Install

Health

CRAN checks
13OK
Slowest check: 3.5 min · r-oldrel-windows-x86_64
Status changes
  • OK13 OK2026-08-05
  • NOTE12 OK, 1 NOTE2026-08-01
  • OK14 OK2026-03-10
Advisories

none known

Documentation

In release 1.0.0
READMEYes · 379 wordsVignettesYes · 7 · dynamicNEWSYes · 100% structured · mentions 1.0.0Citation fileNoWebsiteYes · pkgdown
Help pages
85 (3 internal)includes a package overview page
Examples that run
75%6 run in a plain check · 2 never run
Exported functions with examples
11%
Documented parameters
95%
Return-value docs
83%
Help pages citing references
0%

Downloads

3.6K
CRAN downloads in the past year
Rank #6,465 · ~10/day · ~297/mo
Daily download trend is not available in this view yet.
56230 days
1.3K90 days
3.6K1 year
Compare downloads with other packages →
Also on138 r2u10 autocran

Repository

9Stars
3Forks
34Open issues
2Open PRs
5Releases
269Commits
4Commit identities
269 commits · Last activity 2026-07-05
Responsiveness
How these are sampled
PRs merged (all time)
100%
Median days to close, 50 most recently updated closed issues
307
Median days to close, 50 most recently updated closed PRs
7

Stars over time

2025-07-03 · 92026-07-07 · 9
PracticesBeta

12 development-tooling and community-health practices detected across 6 families in the upstream repository

Checks run against github.com/r-world-devs/cohortbuilder on 2026-10-11.

Continuous integration (2)
GitHub ActionsR CMD check workflow

The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel

Docs source (4)
README.Rmdpkgdown

GitHub Pages site last deployed 2026-07-10 · The repository has a site deploy workflow

pkgdown site last built 2026-07-10

Coverage (1)
Coverage reporting
Reproducibility and dev environment (1)
renv
Show all practicesHide 2 practices
Lint, format, editor (3)
lintrLint workflowRStudio project
Git structural (1)
Submodules
How this is detected·Detection ruleset v3 (2026-09-26)
AI coding toolsBeta

This repository shows signs of AI coding tools.

  • Claude Codefirst seen 2026-05-27
    Seen in the repository: .claude, .claude/skills, CLAUDE.md
    Named in .Rbuildignore: .claude, CLAUDE.md
How this is detected·Detection ruleset v4 (updated 2026-09-27)

Dependencies

Declared dependencies
19 external dependencies (excludes base and recommended)

Installing cohortBuilder adds 33 packages (18 with compiled code, 33 MB of source tarballs). Heaviest: stringi 11 MB, ggplot2 6.0 MB, Rcpp 1.8 MB.

Depends (1)
R >= 4.1.0
LinkingTo (0)
none
Enhances (0)
none
Reverse dependencies
1direct
0indirect
Imports 1
Depends, Imports or LinkingTo, most downloaded first

Datasets

People & History

People (2)
Maintainer since 0.1 (2022), Author
Contributor
Releases (5)

Pick two releases to compare their code metrics.

  • 1.0.0Latest
    record
    2026-07-03 · current release · diff ↗ ·
    removed 10 exports
    .as_constructor, cb_filter.date_range, cb_filter.datetime_range, cb_filter.discrete, cb_filter.discrete_text, cb_filter.multi_discrete, cb_filter.query, cb_filter.range, def_filter, new_filter
    added 43 exports
    .propagate_domains, CbFilter, CbFilterDateRange, CbFilterDatetimeRange, CbFilterDiscrete, CbFilterDiscreteText, CbFilterMultiDiscrete, CbFilterQuery, CbFilterRange, autofilter, cb_domain_from_data, cb_domain_from_stats, cb_filter_data, cb_filter_to_expr, cb_get_filter_data, cb_get_filter_defaults, cb_get_filter_stats, cb_intersect_domain, cb_intersect_domain_values, cb_plot_filter_data, cb_register_tool, cb_register_tools, cb_tool, cb_tool_add_filters, cb_tool_apply_filters, cb_tool_clear_filters, cb_tool_describe_state, cb_tool_filters_meta, cb_tool_get_code, cb_tool_get_data_summary and 13 more
  • R
    R 4.6.0 released · 2026-04-24
  • 0.4.0
    record
    2026-02-24 · diff ↗ ·
    added 1 export
    cb_filter.datetime_range
  • R
    R 4.5.0 released · 2025-04-11
  • 0.3.0
    record
    2024-09-25 · diff ↗ ·
    added 2 exports
    .print_filter, cb_filter.query
  • R
    R 4.4.0 released · 2024-04-24
  • R
    R 4.3.0 released · 2023-04-21
  • 0.2.0
    record
    2023-02-28 · diff ↗ ·
    added 2 exports
    .post_binding, .repro_code_tweak
  • 0.1
    record
    2022-06-01
  • R
    R 4.2.0 released · 2022-04-22

Package metadata

First published
2022-06-01
Total releases
5 / 4 yrs
License
MIT + file LICENSE OSI
Minimum R
≥ 4.1.0
Bundled data
3.0 KB / 1 file
Download size
887 KB

Cite

Cite this package

Run in R for the authors' preferred citation:

citation("cohortBuilder")
Igras, K., & Foryś, A. (2026). cohortBuilder: Data Source Agnostic Filtering Tools (Version 1.0.0) [Computer software]. https://doi.org/10.32614/CRAN.package.cohortBuilder

This package has no citation file, so citation() returns this entry built from DESCRIPTION.

Cite the R Observatory

For a number measured here: a download total, a coverage figure, an archival date.

APA

Balamuta, J. J. (2026). R Observatory: Metrics for cohortBuilder version 1.0.0 [Data set]. HJJB, LLC. Data release v2026-10-19. https://doi.org/10.5281/zenodo.21843040

From data release v2026-10-19, which the citation names so these numbers can be found later. More on citing and the projects behind them.

Report a problem with this page →

Privacy choices

These apply to this browser and are stored on this device only. Nothing about your choice is sent to us.

Read the privacy policy