tlfstack 0.1.0
First release. tlfstack is a clean re-implementation, as an open-source package, of the mechanism layer of a convention-driven clinical TLF reporting system described in a SESUG 2026 conference paper.
Features
- Configuration layer:
tlf_config()holds page geometry, fonts, page header, palette, treatment-variable candidates and render policy. It resolves from the argument, thenoptions(tlfstack.config), then theTLFSTACK_CONFIGYAML file, then defaults. - 8 table/listing builders (9 dispatcher types) and 9 figure builders (12 dispatcher types), all pure functions. Organizations can register their own builders with
tlf_register_table()andtlf_register_figure(). - Structured title blocks (
tlf_titles()) with{placeholder}filling and provenance. - Three-mode title resolution (
tlf_resolve_titles()): live DBI source, then snapshot, then a TODO placeholder with a warning. - A JSON/YAML TOC interchange format (
toc_write(),toc_source_file()) with a published JSON Schema. - pharmaverse interoperability:
as_tlf_table()renders gtsummary tables and cards Analysis Results Data under tlfstack conventions. gtsummary footnotes are kept as builder footnotes.tlf_ard()andtlf_write_ard()export the ARD, one row per statistic, for QC. Registered builders may return gtsummary tables. - Crash-isolated figure rendering with bounded retries and a CSV attempt log (
tlf_run_isolated(),tlf_rtf_figure()).
Fixes relative to the system described in the SESUG 2026 paper
- Snapshot discovery found only
.rdssnapshots by default, so a deployed.csvsnapshot silently degraded to fallback mode.toc_source_dir()now looks for.json,.yml,.yaml,.csvand.rds, and a regression test covers the CSV-only case. - Text is written to RTF verbatim by default. With r2rtf’s default markup conversion,
_in names such ast_demo.Rbecame a subscript and>=became a symbol, which broke character-identical title blocks. RTF control characters are escaped and non-ASCII characters are written as RTF Unicode. r2rtf conversion is available withtlf_config(text_convert = TRUE). - The text-layer font is resolved by name from r2rtf’s public output. It no longer relies on an unexported r2rtf function.
- Portrait tables now get portrait page dimensions.
- Ambiguous TOC matches (several rows for one program and scope) are now an error, not a silent first-row pick. Use
numberto choose. - A treatment group given as a factor keeps its level order in tables and figures.
- A standard deviation from a single value prints as
NE.