crane
0.3.2Supplements the 'gtsummary' Package for Pharmaceutical Reporting
Overview
Tables summarizing clinical trial results are often complex and require detailed tailoring prior to submission to a health authority. The 'crane' package supplements the functionality of the 'gtsummary' package for creating these often highly bespoke tables in the pharmaceutical industry.
New Functions and Functionality
- Added
g_lineplot()for creating line plots with optional summary statistics table. Includes helper functionscalc_stats(),g_lineplot_table(), andpreprocess_lineplot_data(). - Added
ard_tabulate_abnormal_by_baseline()for creating an Analysis Results Data (ARD) object counting participants with abnormal assessments, stratified by their baseline status. - Added
tbl_mmrm()andget_mmrm_results()functions to create regression tables for Mixed Models for Repeated Measures (MMRM). (#163) - Added
gg_mmrm_lineplot()to create line plots of MMRM results. (#181) - Added
gg_pkc_lineplot()to create line plots for PK data. (#185) - Added
annotate_gg_pkc()to add optional summary statistics table to
gg_pkc_lineplot(). (#189)
- Refactored the underlying
data.framealignment and rendering methodology used for plot annotations. Functions for table annotation now use a completely rebuilt engine that ensures X-axis synchronization for stacked tables (annotate_riskdf()) and flexible, reliable placement for floating tables (annotate_surv_med(),annotate_coxph()). (#189) - Refactored functions for lineplot plotting - added
gg_lineplot()andannotate_gg()to create lineplots and annotate summary statistics table. (#184) - Added functions
reverse_ci(),reverse_rate_difference()to reverse confidence intervals and rate differences in tables fromadd_row_difference(). (#204) g_lineplot(),g_lineplot_table(), andpreprocess_lineplot_data()were deprecated. (#184)
Show all changes in 0.3.2Hide the rest of the changes in 0.3.2
- Added
tbl_coxph()to render pairwise Cox proportional hazards results as a gtsummary table. (#159) - Added
tbl_hierarchical_incidence_rate()which computes the incidence rate of adverse events (#211) - Added
adjust_stat_columns_wrap()which keep the presentation of statistics in one row (#219) get_cox_pairwise_df()now allows for different methods to compute p-value (#191) and to handle ties (#193).tbl_coxph()now accepts a data.frame created byget_cox_pairwise_df()as input. (#207)- Added
add_grade_column()to inject a grade-label column intotbl_hierarchical_rate_by_grade()output. Decoupled from the table builder to prevent Cartesian join explosion intbl_merge(). (#226) get_cox_pairwise_df()now fully supportsstrata()terms in survival formulas (#256).- The
"likelihood-ratio"test now intelligently switches betweensurvival::survreg()(for unstratified models) andsurvival::coxph()(for stratified models) (#256). - Stripped package namespace prefixes (e.g.,
survival::) from survival formulas to prevent evaluation errors (#256). - Added
...support inget_cox_pairwise_df()forconf.int(e.g., to adjust CI level) androbust = TRUE(for robust standard errors).
Other Updates
tbl_hierarchical_rate_and_count()now emits zero-rows for unobserved factor levels in the first hierarchical variable. (#233)df2gg_aligned()anddf2gg_floating()now preserve original ggplot objects inattr(result, "plotlist")for downstream data extraction after combining withcowplot. (#208)- Remove warning when data has more levels than needed for grade_groups on tbl_hierarchical_rate_by_grade.
- Changed the default
conf.typefrom"log"to"plain"(linear) intbl_survfit_times()andtbl_survfit_quantiles()to align with GDSR guidelines. (#173) - Removed bold from headers when using
tbl_strata()(#133). - Unified border width in
theme_gtsummary_roche()to 0.5 for header. (#154) - Added example on how to stratify
tbl_baseline_chg()byPARAMand split into a list. - Adjusted
tbl_mmrm()to allowbase_df = NULL. - Fixed two bugs related to summary statistics calculation in
ard_tabulate_abnormal_by_baseline(). (#198) - Fixed a bug in
gg_pkc_lineplot()causing misplaced error bars on a log scale. (#199) - Adjusted
gg_pkc_lineplot()to usetbl_roche_summary()for automatic decimals formatting. - Adjusted
tbl_hierarchical_incidence_rate()to handle first event as well as
all events (#217)
- Adjusted
tbl_baseline_chg()to allow for custiomization of display statistics (#222) - Changed baseline statistic argument in
tbl_baseline_chg()(#224) - Adjusted
modify_zero_recode()to account for strings comprising regular and non-breaking spaces (#230) tbl_roche_subgroups()now showsn,Events, andMedianper arm whentime_to_eventis specified. The total column showsTotal Eventsinstead ofTotal n. (#235)- Skip tests if suggested packages are missing (Failing test due to missing suggested package #252, @llrs-roche)
- The default
"log-rank"test now usessurvival::survdiff()instead ofcoin, aligning output more closely with SAS andrtables
From NEWS.md in the release
Install
Health
- OK13 OK2026-08-05
- NOTE12 OK, 1 NOTE2026-08-01
- OK13 OK2026-07-04
- WARNING12 OK, 1 WARNING2026-07-03
- OK13 OK2026-06-09
Show 6 earlier changesHide 6 earlier changes
- ERROR12 OK, 1 ERROR2026-06-08
- OK13 OK2026-05-09
- ERROR12 OK, 1 ERROR2026-05-03
- OK13 OK2026-05-02
- ERROR11 OK, 1 ERROR2026-04-25
- OK14 OK2026-03-10
Documentation
The repository also keeps web-only articles.
- Help pages
- 47 (12 internal)includes a package overview page
- Examples that run
- 89%40 run in a plain check (14 of them under a condition) · 5 never run
- Exported functions with examples
- 97%
- Documented parameters
- 79%
- Return-value docs
- 97%
- Help pages citing references
- 0%
Downloads
Repository
- PRs merged (all time)
- 91%
- Median days to close, 50 most recently updated closed issues
- 8
- Median days to close, 50 most recently updated closed PRs
- 2
Stars over time
Forks over time
Releases over time
Issues over time
PRs over time
Commits over time
Commit identities over time
16 development-tooling and community-health practices detected across 6 families in the upstream repository
Checks run against github.com/insightsengineering/crane on 2026-10-11.
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
Funding links: pharmaverse.org
GitHub Pages site last deployed 2026-10-02
pkgdown site last built 2026-10-02
Show all practicesHide 2 practices
This repository shows signs of AI coding tools.
- GitHub Copilotfirst seen 2026-02-12Pull request: opened by its own accountCommits: 3 by its own account · at least 8 crediting it in the message
Dependencies
Installing crane adds 85 packages (44 with compiled code, 77 MB of source tarballs). Heaviest: stringi 11 MB, ggplot2 6.0 MB, data.table 5.7 MB.
CRAN will archive these unless their check problems are fixed by the date shown. This package needs each one to install.
- flextablefix by Oct 22
Code & Tests
People & History
Previously maintained by Daniel D. Sjoberg (0.1.0 to 0.3.0).
Pick two releases to compare their code metrics.
- 0.3.2Latest2026-06-03 · current release · diff ↗ ·
removed 1 export
g_forestadded 21 exports
add_forest, add_grade_column, adjust_stat_columns_wrap, annotate_lineplot_df, annotate_pkc_df, ard_tabulate_abnormal_by_baseline, df_add_poolings, g_lineplot, g_lineplot_table, get_mmrm_results, gg_lineplot, gg_mmrm_lineplot, gg_pkc_lineplot, preprocess_lineplot_data, reverse_ci, reverse_rate_difference, tbl_coxph, tbl_hierarchical_incidence_rate, tbl_mmrm, tbl_rmpt, tbl_with_pools - RR 4.6.0 released · 2026-04-24
- 0.3.12026-01-21 · diff ↗ ·
added 8 exports
annotate_coxph, annotate_riskdf, annotate_surv_med, g_forest, get_cox_pairwise_df, gg_km, process_survfit, tbl_roche_subgroups - 0.3.02025-12-06 · diff ↗ ·
removed 1 export
label_style_numberadded 4 exports
add_difference_row, label_roche_number, style_roche_number, tbl_null_report - 0.2.02025-08-29 · diff ↗ ·
removed 4 exports
add_blank_row, all_categorical, all_continuous, roche_pvalueadded 22 exports
add_blank_rows, add_hierarchical_count_row, add_overall, filter_hierarchical, label_roche_percent, label_roche_ratio, label_style_number, modify_header_rm_md, modify_zero_recode, remove_duplicate_keys, sort_hierarchical, style_roche_percent, style_roche_pvalue, style_roche_ratio, tbl_baseline_chg, tbl_hierarchical_rate_and_count, tbl_hierarchical_rate_by_grade, tbl_listing, tbl_roche_summary, tbl_shift, tbl_survfit_quantiles, tbl_survfit_times - RR 4.5.0 released · 2025-04-11
- 0.1.02025-02-24
- RR 4.4.0 released · 2024-04-24
Package metadata
- First published
- 2025-02-24
- Total releases
- 5 / 1 yrs
- License
- Apache License 2.0 OSI
- Minimum R
- ≥ 4.2
- Download size
- 271 KB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("crane")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.
From data release v2026-10-17, which the citation names so these numbers can be found later. More on citing and the projects behind them.