Title: | Supplements the 'gtsummary' Package for Pharmaceutical Reporting |
Version: | 0.1.0 |
Description: | 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. |
License: | Apache License 2.0 |
URL: | https://github.com/insightsengineering/crane, https://insightsengineering.github.io/crane/ |
BugReports: | https://github.com/insightsengineering/crane/issues |
Depends: | R (≥ 4.2) |
Imports: | cli (≥ 3.6.4), dplyr (≥ 1.1.4), flextable (≥ 0.9.7), gt (≥ 0.11.1), gtsummary (≥ 2.1.0), rlang (≥ 1.1.5) |
Suggests: | testthat (≥ 3.0.0) |
Config/Needs/check: | hms |
Config/Needs/website: | rmarkdown, yaml, insightsengineering/nesttemplate |
Config/testthat/edition: | 3 |
Config/testthat/parallel: | true |
Encoding: | UTF-8 |
Language: | en-US |
RoxygenNote: | 7.3.2 |
NeedsCompilation: | no |
Packaged: | 2025-02-21 22:53:07 UTC; sjobergd |
Author: | Daniel D. Sjoberg |
Maintainer: | Daniel D. Sjoberg <danield.sjoberg@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2025-02-24 17:00:07 UTC |
crane: Supplements the 'gtsummary' Package for Pharmaceutical Reporting
Description
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.
Author(s)
Maintainer: Daniel D. Sjoberg danield.sjoberg@gmail.com (ORCID)
Authors:
Emily de la Rua emily.de_la_rua@contractors.roche.com
Davide Garolini davide.garolini@roche.com
Abinaya Yogasekaram abinaya.yogasekaram@contractors.roche.com
Other contributors:
F. Hoffmann-La Roche AG [copyright holder, funder]
See Also
Useful links:
Report bugs at https://github.com/insightsengineering/crane/issues
Add Blank Row
Description
Add a blank row below each variable group. A blank row will not be added to the bottom of the table.
NOTE: For HTML flextable output (which includes the RStudio IDE Viewer), the blank rows do not render. But they will appear when the table is rendered to Word.
Usage
add_blank_row(x)
Arguments
x |
( |
Value
updated 'gtsummary' table
Examples
gtsummary::trial |>
tbl_demographics(
by = trt,
include = c(age, marker, grade)
) |>
add_blank_row()
Objects exported from other packages
Description
These objects are imported from other packages. Follow the links below to see their documentation.
- dplyr
- gtsummary
Round p-values
Description
Round p-values
Usage
roche_pvalue(
x,
big.mark = ifelse(decimal.mark == ",", " ", ","),
decimal.mark = getOption("OutDec"),
...
)
label_roche_pvalue(
big.mark = ifelse(decimal.mark == ",", " ", ","),
decimal.mark = getOption("OutDec"),
...
)
Arguments
x |
( |
big.mark |
( |
decimal.mark |
( |
... |
Arguments passed on to |
Value
A character vector of rounded p-values
Examples
x <- c(0.0000001, 0.123456)
roche_pvalue(x)
label_roche_pvalue()(x)
Demographics Table
Description
This is a thin wrapper of gtsummary::tbl_summary()
with the following differences:
Default summary type for continuous variables is
'continuous2'
.Number of non-missing observations is added for each variable by default and placed on the row under the header.
The
tbl_summary(missing*)
arguments have been renamed totbl_demographics(nonmissing*)
with updated default values.The default footnotes from
tbl_summary()
are removed.
Usage
tbl_demographics(
data,
by = NULL,
label = NULL,
statistic = list(all_continuous() ~ c("{mean} ({sd})", "{median}", "{min} - {max}"),
all_categorical() ~ "{n} ({p}%)"),
digits = NULL,
type = NULL,
value = NULL,
nonmissing = c("always", "ifany", "no"),
nonmissing_text = "n",
nonmissing_stat = "{N_nonmiss}",
sort = all_categorical(FALSE) ~ "alphanumeric",
percent = c("column", "row", "cell"),
include = everything()
)
Arguments
data |
( |
by |
( |
label |
( |
statistic |
( |
digits |
( |
type |
( |
value |
( |
nonmissing , nonmissing_text , nonmissing_stat |
Arguments dictating how and if missing values are presented:
|
sort |
( |
percent |
( |
include |
( |
Value
a 'gtsummary' table
Examples
# Example 1 ----------------------------------
gtsummary::trial |>
tbl_demographics(
by = trt,
include = c(age, grade)
)
Roche Theme
Description
A gtsummary theme for Roche tables
Calls the
gtsummary::theme_gtsummary_compact()
theme.Uses
label_roche_pvalue()
as the default formatting function for all p-values.Defaults to a mono-spaced font for gt tables.
Usage
theme_gtsummary_roche(set_theme = TRUE, font_size = NULL)
Arguments
set_theme |
(scalar |
font_size |
(scalar |
Value
theme list
Examples
theme_gtsummary_roche()
tbl_demographics(gtsummary::trial, by = trt, include = c(age, grade))
gtsummary::reset_gtsummary_theme()