From 540c7572271ad0c1fe81e9b18bcc7561249b116e Mon Sep 17 00:00:00 2001 From: Emily de la Rua Date: Wed, 16 Oct 2024 17:14:54 -0400 Subject: [PATCH] Fix example --- R/count_cumulative.R | 2 +- R/count_occurrences_by_grade.R | 3 ++- man/count_occurrences_by_grade.Rd | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/R/count_cumulative.R b/R/count_cumulative.R index 8e470c52cd..5143f0d474 100644 --- a/R/count_cumulative.R +++ b/R/count_cumulative.R @@ -79,7 +79,7 @@ h_count_cumulative <- function(x, result <- c( count = count, - fraction = if (count == 0 && .N_col == 0) c(0, 0) else c(count, count / .N_col) + fraction = if (count == 0 && .N_col == 0) 0 else count / .N_col ) result } diff --git a/R/count_occurrences_by_grade.R b/R/count_occurrences_by_grade.R index a26686aeee..1c2a18376a 100644 --- a/R/count_occurrences_by_grade.R +++ b/R/count_occurrences_by_grade.R @@ -234,12 +234,13 @@ s_count_occurrences_by_grade <- function(df, #' * `a_count_occurrences_by_grade()` returns the corresponding list with formatted [rtables::CellValue()]. #' #' @examples -#' # We need to ungroup `count_fraction` first so that the `rtables` formatting +#' # We need to ungroup `count_fraction` first so that the `rtables` formatting #' # function `format_count_fraction()` can be applied correctly. #' afun <- make_afun(a_count_occurrences_by_grade, .ungroup_stats = "count_fraction") #' afun( #' df, #' .N_col = 10L, +#' .N_row = 10L, #' .var = "AETOXGR", #' id = "USUBJID", #' grade_groups = list("ANY" = levels(df$AETOXGR)) diff --git a/man/count_occurrences_by_grade.Rd b/man/count_occurrences_by_grade.Rd index ab33889983..497f7c40fe 100644 --- a/man/count_occurrences_by_grade.Rd +++ b/man/count_occurrences_by_grade.Rd @@ -261,12 +261,13 @@ s_count_occurrences_by_grade( grade_groups = list("ANY" = levels(df$AETOXGR)) ) -# We need to ungroup `count_fraction` first so that the `rtables` formatting +# We need to ungroup `count_fraction` first so that the `rtables` formatting # function `format_count_fraction()` can be applied correctly. afun <- make_afun(a_count_occurrences_by_grade, .ungroup_stats = "count_fraction") afun( df, .N_col = 10L, + .N_row = 10L, .var = "AETOXGR", id = "USUBJID", grade_groups = list("ANY" = levels(df$AETOXGR))