Skip to content

Add vignette: modular TLG pipeline (compute → tabulate → customize) #249

Description

@Melkiades

Motivation

The get_cox_pairwise_df()tbl_coxph()modify_*() pattern demonstrates crane's modular design: statistics are computed separately from tabulation, and formatting can be customized at each layer. This pattern applies broadly across crane but is not documented in a user-facing way.

Proposed vignette

A short vignette (vignettes/modular-pipeline.Rmd) covering:

1. The three layers

  • Compute — functions like get_cox_pairwise_df() that produce a statistics data frame
  • Tabulate — functions like tbl_coxph() that render the data frame as a gtsummary table
  • Customizemodify_fmt_fun(), modify_header(), pre-formatting columns, .format_pvalue() pass-through

2. When to set digits / formatting at each layer

  • At compute time: HR and CI precision is set by get_cox_pairwise_df() via sprintf("%.2f", ...)
  • At tabulate time: p-value precision is set by .format_pvalue() inside tbl_coxph()
  • After the fact: users can pre-format the p-value column as character (pass-through) or use modify_fmt_fun() on the gtsummary output

3. Other modular components

  • tbl_hierarchical_rate_by_grade() + add_grade_column() — decoupled styling
  • tbl_roche_subgroups() + add_forest() — decoupled forest plot
  • tbl_with_pools() — pooling wrapper that works with any .tbl_fun

4. Swapping layers

  • Bring your own data frame to tbl_coxph() (e.g., from a different statistical engine)
  • Use a different .tbl_fun inside tbl_roche_subgroups()

Ref: discussion in #245

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions