Skip to content

Commit d6dc934

Browse files
huanlugwuaassuied-psedelaruagithub-actions[bot]dependabot-preview[bot]
authored
update branch 207 (#222)
* 201 new figure figure 14 (#209) * First draft First draft (not fully working) * New push Now the results are correct. Colors in the table are missing and the order of the group is not correct. * Delete width= in geom_errorbar To avoid warning `position_dodge()` requires non-overlapping x intervals * Update Put example in comments @examples * Update fda-fig_14 and argument convention * tests Update setup.R to add ggplot2 * quarto page * _quarto.yml and NEWS.md * typo * Put PARAMCD in code mode * Remove id_var, add visit_var, reverse order of table rows * [skip actions] Restyle files * Add to index * [skip actions] Restyle files * Empty commit * Fix unrelated broken template * [skip actions] Roxygen Man Pages Auto Update * Empty commit * Fix lint * Fix imports/exports * Update template --------- Co-authored-by: Emily de la Rua <[email protected]> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: 27856297+dependabot-preview[bot]@users.noreply.github.com <27856297+dependabot-preview[bot]@users.noreply.github.com> * 196-new-table-38 (#204) * 1st commitment for all documents * [skip actions] Restyle files * [skip actions] Roxygen Man Pages Auto Update * Fix table 35 title * Update index * Update label indentation --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: 27856297+dependabot-preview[bot]@users.noreply.github.com <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Emily de la Rua <[email protected]> * 195 new table table 36 (#208) * Add make_table_36 * Add tests for make_table_36 * Addd quarto page for make_table_36 * [skip actions] Restyle files * Update NEWS file * Remove scda from table 22 * Solve lintr marks for table 22 * empty commit * Update WORDLIST --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Abinaya Yogasekaram <[email protected]> Co-authored-by: ayogasekaram <[email protected]> Co-authored-by: Emily de la Rua <[email protected]> * 105 table 09 tplyr (#192) * Prepare first raw tplyr table including risk difference columns * Table 9 Tplyr: Update header string in case risk difference columns are expected * Table 9 Tplyr: Add parameter for overall column * Tab 9 Tplyr: Introduce soc_var parameter * Add show_colcounts and prune functionality * Clean comments * Replace remaining hard-coded variable names by parameters * Add option to return a gt_table object * Add checkmate checks * Allow for both, character and factor, since tplyr seems to prefer character * Update roxygen documentation * Add make_table_09_tplyr() to web page * Establish first test cases * Add test for correct column header assignment (make_table_09_tplyr) * Add column ordering based on arm order for make_table_09_tplyr * Add final tests and clean * [skip actions] Restyle files * Solve lintr markers * Update after devtools::check() * [skip actions] Restyle files * [skip actions] Roxygen Man Pages Auto Update * Restart github check by code modification * Update example data frpm scda to random.cdisc.data * [skip actions] Restyle files * [skip actions] Roxygen Man Pages Auto Update * Set RoxygenNote to 7.3.0 as required by GitHub action * Fix make_table_09_tplyr() row order * Add scda to 'Suggests' since table 22 still includes it in the example and tests * Move scda from Suggests to Imports since table 22 quarto page relies on it as well... * Replace scda w/ random.cdisc.data for table 22 examples and tests * [skip actions] Roxygen Man Pages Auto Update * Restrict Tplyr version to <= 1.1.0 until newly introduced incompatibilities w/ higher versions are solved * Restrict to Tplyr version 1.1.0 * Remove version restriction for Tplyr * Deactivate risk difference feature until {Tplyr} issue is solved * Re-document * [skip style] [skip vbump] Restyle files --------- Co-authored-by: mattkorb <[email protected]> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: 27856297+dependabot-preview[bot]@users.noreply.github.com <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: ayogasekaram <[email protected]> * Update boehringer company logo on website (#214) * [skip actions] Bump version to 0.1.0.9054 * 211 new table table 33 with gtsummary (#212) Closes #211 * [skip actions] Bump version to 0.1.0.9055 * 205_BUG_fix _make_table_34 Issue (#215) * Calculate counts for FMQ levels. Updated test file and Qualt file accordingly. * [skip style] [skip vbump] Restyle files * [skip roxygen] [skip vbump] Roxygen Man Pages Auto Update * lint R check * [skip style] [skip vbump] Restyle files --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: 27856297+dependabot-preview[bot]@users.noreply.github.com <27856297+dependabot-preview[bot]@users.noreply.github.com> --------- Co-authored-by: Alex Assuied <[email protected]> Co-authored-by: Emily de la Rua <[email protected]> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: 27856297+dependabot-preview[bot]@users.noreply.github.com <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: YoshitoKoujin <[email protected]> Co-authored-by: Korbinian Matthias <[email protected]> Co-authored-by: Abinaya Yogasekaram <[email protected]> Co-authored-by: ayogasekaram <[email protected]> Co-authored-by: Jessica Knizia <[email protected]> Co-authored-by: mattkorb <[email protected]> Co-authored-by: edelarua <[email protected]>
1 parent 1cef836 commit d6dc934

File tree

123 files changed

+4856
-1197
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+4856
-1197
lines changed

.github/ISSUE_TEMPLATE/new_template.yml

-1
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,3 @@ body:
5757
- [ ] **Screenshot:** Add table screenshot as `table_XX.png` to the `quarto/assets/images/screenshots` folder.
5858
- [ ] **_quarto.yml:** Add template to the "Template Library" section of the `_quarto.yml` file.
5959
- [ ] **Template Index:** Run `quarto/assets/generate-template_index.R` script to update the template index.
60-
- [ ] **NEWS:** Update `NEWS.md`.

.pre-commit-config.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# R specific hooks: https://github.com/lorenzwalthert/precommit
44
repos:
55
- repo: https://github.com/lorenzwalthert/precommit
6-
rev: v0.4.0
6+
rev: v0.4.2
77
hooks:
88
- id: style-files
99
args: [--style_pkg=styler, --style_fun=tidyverse_style]
@@ -50,7 +50,7 @@ repos:
5050
hooks:
5151
- id: prettier
5252
- repo: https://github.com/pre-commit/pre-commit-hooks
53-
rev: v4.5.0
53+
rev: v4.6.0
5454
hooks:
5555
- id: check-added-large-files
5656
args: ["--maxkb=200"]
@@ -76,6 +76,6 @@ repos:
7676
files: '\.Rhistory|\.RData|\.Rds|\.rds$'
7777
# `exclude: <regex>` to allow committing specific files.
7878
- repo: https://github.com/igorshubovych/markdownlint-cli
79-
rev: v0.38.0
79+
rev: v0.39.0
8080
hooks:
8181
- id: markdownlint

DESCRIPTION

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Type: Package
22
Package: falcon
33
Title: FDA Safety Tables and Figures
4-
Version: 0.1.0.9053
5-
Date: 2024-01-25
4+
Version: 0.1.0.9055
5+
Date: 2024-04-24
66
Authors@R:
77
person("Pawel", "Rucki", , "[email protected]", role = c("aut", "cre"))
88
Description: R package with implementation of Safety Tables and Figures
@@ -12,29 +12,30 @@ URL: https://github.com/pharmaverse/falcon/
1212
BugReports: https://github.com/pharmaverse/falcon/issues
1313
Depends:
1414
R (>= 3.6),
15-
tern (>= 0.9.3)
15+
tern (>= 0.9.4)
1616
Imports:
1717
checkmate,
1818
cowplot (>= 0.7.0),
1919
dplyr,
20-
formatters (>= 0.5.5),
20+
formatters (>= 0.5.6),
2121
ggplot2 (>= 3.4.0),
2222
gt,
2323
gtsummary,
2424
lubridate,
2525
magrittr,
2626
purrr (>= 1.0.1),
2727
rlang (>= 0.4.11),
28-
rlistings (>= 0.2.7),
29-
rtables (>= 0.6.6),
28+
rlistings (>= 0.2.8),
29+
rtables (>= 0.6.7),
3030
tfrmt,
3131
tidyr,
3232
Tplyr
3333
Suggests:
3434
knitr,
3535
random.cdisc.data (>= 0.3.14),
3636
svglite (>= 2.1.2),
37-
testthat (>= 3.0.0)
37+
testthat (>= 3.0.0),
38+
withr (>= 2.0.0)
3839
Remotes:
3940
insightsengineering/random.cdisc.data@*release
4041
biocViews:

NAMESPACE

+9
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export(alt_counts_df_preproc)
44
export(basic_table_annot)
55
export(make_fig_01)
66
export(make_fig_02)
7+
export(make_fig_14)
78
export(make_table_02)
89
export(make_table_02_gtsum)
910
export(make_table_02_tplyr)
@@ -15,6 +16,7 @@ export(make_table_07)
1516
export(make_table_08)
1617
export(make_table_09)
1718
export(make_table_09_gtsum)
19+
export(make_table_09_tplyr)
1820
export(make_table_10)
1921
export(make_table_11)
2022
export(make_table_12)
@@ -30,10 +32,14 @@ export(make_table_22)
3032
export(make_table_32)
3133
export(make_table_32_gtsum)
3234
export(make_table_33)
35+
export(make_table_33_gtsum)
3336
export(make_table_34)
3437
export(make_table_35)
38+
export(make_table_36)
39+
export(make_table_38)
3540
export(split_cols_by_arm)
3641
import(Tplyr)
42+
import(checkmate)
3743
import(dplyr)
3844
import(ggplot2)
3945
import(gt)
@@ -52,8 +58,11 @@ importFrom(rlang,":=")
5258
importFrom(rlang,.data)
5359
importFrom(rlistings,as_listing)
5460
importFrom(stats,median)
61+
importFrom(stats,prop.test)
62+
importFrom(stats,qt)
5563
importFrom(stats,quantile)
5664
importFrom(stats,sd)
65+
importFrom(stats,setNames)
5766
importFrom(tidyr,pivot_longer)
5867
importFrom(tidyr,pivot_wider)
5968
importFrom(tidyr,separate_rows)

NEWS.md

+2-20
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,3 @@
1-
# falcon 0.1.0.9053
1+
# falcon 0.1.0.9055
22

3-
### New Features
4-
* Added new functions for creating standard FDA tables: `make_table_02`, `make_table_03`, `make_table_04`, `make_table_05`,
5-
`make_table_06`, `make_table_07`, `make_table_08`, `make_table_09`, `make_table_10`, `make_table_11`, `make_table_12`,
6-
`make_table_13`, `make_table_14`, `make_table_15`, `make_table_16`, `make_table_17`, `make_table_18`, `make_table_20`,
7-
`make_table_21`, `make_table_22`, `make_table_32`, `make_table_33`, `make_table_34`, `make_table_35`.
8-
* Added new functions for creating standard FDA figures: `make_fig_01`, `make_fig_02`.
9-
* Added helper functions used within table functions:
10-
* `basic_table_annot` for adding basic table annotations (titles, footnotes, column counts).
11-
* `split_cols_by_arm` for splitting columns by arm with option to add total column.
12-
* `alt_counts_df_preproc` for pre-processing the `alt_counts_df` dataset.
13-
* `assert_flag_variables` (internal) for checking that formatting is correct for flag variables in the data.
14-
* Added new functions for creating standard FDA tables using additional packages: `make_table_02_tplyr`, `make_table_02_gtsum`,
15-
`make_table_09_gtsum`, `make_table_32_gtsum`.
16-
* Added option to include risk difference columns in tables using the `split_cols_by_arm` function via the `risk_diff` argument.
17-
* Added risk difference functionality into relevant table-generating functions via the `risk_diff` argument.
18-
19-
### Miscellaneous
20-
* Initialized the package.
21-
* Developed Quarto website.
3+
* Initial release.

R/argument_convention.R

+32-7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,34 @@
22
#'
33
#' This documentation lists all the arguments in `falcon` that are used repeatedly by functions to output tables.
44
#'
5+
#' @param show_colcounts (`flag`)\cr Whether column counts should be printed. Boolean.
6+
#' @param arm_var (`character`)\cr Name of the treatment arm variable used to split table into columns.
7+
#' @param id_var (`character`)\cr Name of the unique subject identifiers variable.
8+
#' @param saffl_var (`character`)\cr Name of the safety flag variable which must contain at least "Y" for "Yes".
9+
#' @param ser_var (`character`)\cr Name of the serious adverse event flag variable which must contain at least
10+
#' "Y" for "Yes".
11+
#' @param lbl_overall (`character`)\cr Optional. If specified, an overall column will be added to the table with
12+
#' the given value as the column label.
13+
#' @param vars (`vector` of `character`)\cr Variables from `df` to include in the table.
14+
#' @param lbl_vars (`vector` of `character`)\cr Labels corresponding to variables in `vars` to print
15+
#' in the table. Labels should be ordered according to the order of variables in `vars`.
16+
#' @param pref_var (`character`)\cr Name of the preferred term variable from `adae` to include in the table.
17+
#' @param soc_var (`character`)\cr Name of the system organ class variable from `adae` to include in the table.
18+
#' @param lbl_pref_var (`character`)\cr Label corresponding to preferred term variable `pref_var` to print in the table.
19+
#' @param lbl_soc_var (`character`)\cr Label corresponding to system organ class variable `soc_var` to print in the
20+
#' table.
21+
#' @param .stats (`character`)\cr Statistics to include in the table. Includes statistics for all variable
22+
#' types (only the statistics that are valid for a given variable's type will be printed).
23+
#' See [`tern::analyze_vars()`] for options.
24+
#' @param .formats (named `list` of `character`)\cr List of formats corresponding to each value in `.stats`.
25+
#' Each name is a value in `.stats` and the corresponding value is the format that should be applied to
26+
#' that statistic. See [`formatters::list_valid_format_labels()`] for a list of valid formats.
27+
#' @param na_rm (`flag`)\cr Whether `NA` levels should be removed from the table.
28+
#' @param prune_0 (`flag`)\cr Whether all-zero rows should be removed from the table. Boolean.
29+
#' @param annotations (named `list` of `character`)\cr List of annotations to add to the table. Valid
30+
#' annotation types are `title`, `subtitles`, `main_footer`, and `prov_footer`. Each name-value pair should
31+
#' use the annotation type as name and the desired string as value.
32+
#' @param na_level (`character`)\cr String to represent missing values.
533
#' @param adae (`data.frame`)\cr dataset (typically ADAE) required to build table.
634
#' @param adex (`data.frame`)\cr dataset (typically ADEX) required to build table.
735
#' @param advs (`data.frame`)\cr dataset (typically ADVS) required to build table.
@@ -10,7 +38,6 @@
1038
#' @param annotations (named `list` of `character`)\cr list of annotations to add to the table. Valid
1139
#' annotation types are `title`, `subtitles`, `main_footer`, and `prov_footer`. Each name-value pair should
1240
#' use the annotation type as name and the desired string as value.
13-
#' @param arm_var (`character`)\cr arm variable used to split table into columns.
1441
#' @param df (`data.frame`)\cr dataset required to build table.
1542
#' @param eosdy_var (`character`)\cr variable denoting last recorded (relative) study day.
1643
#' @param fmqsc_var (`character`)\cr FMQ scope variable to use in table.
@@ -27,8 +54,6 @@
2754
#' in the table. Labels should be ordered according to the order of variables in `vars`.
2855
#' @param na_level (`character`)\cr string to represent missing values.
2956
#' @param na_rm (`flag`)\cr whether `NA` levels should be removed from the table.
30-
#' @param pref_var (`character`)\cr preferred term variable from `adae` to include in the table.
31-
#' @param prune_0 (`flag`)\cr whether all-zero rows should be removed from the table.
3257
#' @param risk_diff (named `list`)\cr list of settings to apply to add one or more risk difference columns to the table.
3358
#' Defaults to `NULL` (no risk difference column added). See [tern::add_riskdiff()] for more details. List should
3459
#' contain the following elements:
@@ -41,16 +66,16 @@
4166
#' * `pct`: (optional) whether the output should be returned as percentages. Defaults to `TRUE`.
4267
#' @param saffl_var (`character`)\cr flag variable used to indicate inclusion in safety population.
4368
#' @param sex_scope (`character`)\cr Level of `SEX` to output in table.
44-
#' @param soc_var (`character`)\cr flag variable used to indicate system organ class.
45-
#' @param show_colcounts (`flag`)\cr whether column counts should be printed.
46-
#' @param trtsdtm_var (`character`)\cr treatment start datetime variable.
4769
#' @param trtedtm_var (`character`)\cr treatment end datetime variable.
70+
#' @param trtemfl_var (`character`)\cr flag variable used to identify Treatment-emergent AE.
71+
#' @param trtsdtm_var (`character`)\cr treatment start datetime variable.
4872
#' @param u_trtdur (`character`)\cr unit for duration of treatment. Options are `"days"`, `"weeks"`, `"months"`,
4973
#' and `"years"`.
50-
#' @param vars (`vector` of `character`)\cr variables from `df` to include in the table.
5174
#' @param xticks (`vector` of `numeric`)\cr x-axis tick positions. If `NA` (default), tick mark positions are
5275
#' automatically calculated.
5376
#' @param x_lab (`character`)\cr x-axis label.
77+
#' @param yticks (`vector` of `numeric`)\cr y-axis tick positions. If `NA` (default), tick mark positions are
78+
#' automatically calculated.
5479
#' @param y_lab (`character`)\cr y-axis label.
5580
#'
5681
#' @name argument_convention

R/falcon.R

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@
55
#' @keywords internal
66
"_PACKAGE"
77

8-
9-
#' @import dplyr ggplot2 gt gtsummary rtables tern tfrmt Tplyr
8+
#' @import dplyr ggplot2 checkmate gt gtsummary rtables tern tfrmt Tplyr
109
#' @importFrom rlang .data :=
1110
#' @importFrom magrittr %>%
1211
#' @importFrom purrr walk
13-
#' @importFrom stats median sd quantile
12+
#' @importFrom stats median sd quantile prop.test qt setNames
1413
#' @importFrom tidyr pivot_longer separate_rows pivot_wider
1514
#' @importFrom formatters with_label var_labels var_relabel
1615
#' @importFrom rlistings as_listing
@@ -24,5 +23,6 @@ utils::globalVariables(c(
2423
"MAX_DIABP", "MAX_SYSBP", "PARAMCD", "SEX", "TRTDUR", "TRTDUR_MONTHS", "TRTEDT", "ASER", "DCTREAS",
2524
"EOSSTT", "EOTSTT", "ITTFL", "PPROTFL", "RANDFL", "TRTEMFL", "TRTSDT", "USUBJID", "column", "median", "ord_layer_1",
2625
"ord_layer_2", "ord_layer_index", "param", "pct", "row_label1", "row_label2", "sd", "tbl_lbl", "value",
27-
"ENRLDT", "RANDDT", "G110", "G60", "G90", "GE120", "L60", "N", "val", "id_var", "PT_PCT", "arm", "x", "TLSTFU"
26+
"ENRLDT", "RANDDT", "G110", "G60", "G90", "GE120", "L60", "N", "val", "id_var", "PT_PCT", "arm", "x", "TLSTFU",
27+
"se", "lower_ci", "upper_ci", "SBP90", "DBP60"
2828
))

R/fda-fig_01.R

+6-3
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ make_fig_01 <- function(df,
3939
ggtheme = NULL,
4040
add_table = TRUE,
4141
annotations = NULL) {
42-
checkmate::assert_subset(c(arm_var, id_var, saffl_var, trtsdtm_var, trtedtm_var), names(df))
43-
checkmate::assert_choice(u_trtdur, c("days", "weeks", "months", "years"))
42+
assert_subset(c(arm_var, id_var, saffl_var, trtsdtm_var, trtedtm_var), names(df))
43+
assert_choice(u_trtdur, c("days", "weeks", "months", "years"))
4444
assert_flag_variables(df, saffl_var)
4545

4646
df <- df %>%
@@ -82,7 +82,10 @@ make_fig_01 <- function(df,
8282
if (!is.null(ggtheme)) g <- g + ggtheme
8383

8484
if (add_table) {
85-
g_legend <- cowplot::get_legend(g)
85+
# following 2 lines replace `g_legend <- cowplot::get_legend(g)` which is currently broken
86+
legend_pos <- paste0("guide-box-", ifelse(is.null(ggtheme), "bottom", ggtheme$legend.position))
87+
g_legend <- cowplot::get_plot_component(g, legend_pos, return_all = TRUE)
88+
8689
g <- g + theme(legend.position = "none")
8790

8891
xtick_lbls <- ggplot_build(g)$layout$panel_params[[1]]$x$breaks

R/fda-fig_02.R

+6-3
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ make_fig_02 <- function(df,
3737
ggtheme = NULL,
3838
add_table = TRUE,
3939
annotations = NULL) {
40-
checkmate::assert_subset(c(arm_var, id_var, saffl_var, eosdy_var), names(df))
41-
checkmate::assert_choice(u_trtdur, c("days", "weeks", "months", "years"))
40+
assert_subset(c(arm_var, id_var, saffl_var, eosdy_var), names(df))
41+
assert_choice(u_trtdur, c("days", "weeks", "months", "years"))
4242
assert_flag_variables(df, saffl_var)
4343

4444
df <- df %>%
@@ -80,7 +80,10 @@ make_fig_02 <- function(df,
8080
if (!is.null(ggtheme)) g <- g + ggtheme
8181

8282
if (add_table) {
83-
g_legend <- cowplot::get_legend(g)
83+
# following 2 lines replace `g_legend <- cowplot::get_legend(g)` which is currently broken
84+
legend_pos <- paste0("guide-box-", ifelse(is.null(ggtheme), "bottom", ggtheme$legend.position))
85+
g_legend <- cowplot::get_plot_component(g, legend_pos, return_all = TRUE)
86+
8487
g <- g + theme(legend.position = "none")
8588

8689
xtick_lbls <- ggplot_build(g)$layout$panel_params[[1]]$x$breaks

0 commit comments

Comments
 (0)