Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

24 MHT01 #115

Merged
merged 5 commits into from
Jan 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ export(ext01_2)
export(ext01_2_lyt)
export(lbt01_1)
export(lbt01_1_lyt)
export(mht01_1)
export(mht01_1_lyt)
export(pivot_wider_labels)
export(pmap_row)
export(preprocess_data)
Expand Down
80 changes: 40 additions & 40 deletions R/aet02.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#' AET02 Table 1 (Default) Adverse Events by System Organ Class and Preferred Term Table 1
#' `AET02` Table 1 (Default) Adverse Events by System Organ Class and Preferred Term Table 1
#'
#' The AET02 table provides an overview of the number of patients experiencing advert events and the number of advert
#' The `AET02` table provides an overview of the number of subjects experiencing adverse events and the number of advert
#' events categorized by Body System and Dictionary-Derived Term.
#'
#' @inheritParams gen_args
#'
#' @details
#' * Numbers represent absolute numbers of patients and fraction of `N`, or absolute number of event when specified.
#' * Numbers represent absolute numbers of subject and fraction of `N`, or absolute number of event when specified.
#' * Remove zero-count rows unless overridden with `prune_0 = FALSE`.
#' * Split columns by arm.
#' * Does not include a total column by default.
Expand Down Expand Up @@ -57,8 +57,8 @@ aet02_1 <- function(adam_db,
lyt <- aet02_1_lyt(
armvar = armvar,
lbl_overall = lbl_overall,
lbl_AEBODSYS = var_labels_for(dbsel$adae, "AEBODSYS"),
lbl_AEDECOD = var_labels_for(dbsel$adae, "AEDECOD"),
lbl_aebodsys = var_labels_for(dbsel$adae, "AEBODSYS"),
lbl_aedecod = var_labels_for(dbsel$adae, "AEDECOD"),
deco = deco
)

Expand All @@ -82,13 +82,13 @@ aet02_1 <- function(adam_db,
}


#' AET01 Layout 1 (Default)
#' `AET02` Layout 1 (Default)
#'
#' @describeIn aet02_1
#'
#' @inheritParams gen_args
#' @param lbl_AEBODSYS (`string`) text label for AEBODSYS.
#' @param lbl_AEDECOD (`string`) text label for AEDECOD.
#' @param lbl_aebodsys (`character`) text label for `AEBODSYS`.
#' @param lbl_aedecod (`character`) text label for `AEDECOD`.
#'
#' @export
#'
Expand All @@ -100,8 +100,8 @@ aet02_1 <- function(adam_db,
#' )
aet02_1_lyt <- function(armvar = .study$armvar,
lbl_overall = .study$lbl_overall,
lbl_AEBODSYS = "Body System or Organ Class",
lbl_AEDECOD = "Dictionary-Derived Term",
lbl_aebodsys = "Body System or Organ Class",
lbl_aedecod = "Dictionary-Derived Term",
deco = std_deco("AET02"),
.study = list(
armvar = "ACTARM",
Expand All @@ -127,7 +127,7 @@ aet02_1_lyt <- function(armvar = .study$armvar,
indent_mod = -1L,
split_fun = drop_split_levels,
label_pos = "topleft",
split_label = lbl_AEBODSYS
split_label = lbl_aebodsys
) %>%
summarize_num_patients(
var = "USUBJID",
Expand All @@ -141,16 +141,16 @@ aet02_1_lyt <- function(armvar = .study$armvar,
vars = "AEDECOD",
.indent_mods = -1L
) %>%
append_topleft(paste0(" ", lbl_AEDECOD))
append_topleft(paste0(" ", lbl_aedecod))
}


# Version2 ----

#' AET02 Table 2 (Supplementary) Adverse Events by System Organ Class, High Level Term and Preferred Term Table 2
#' `AET02` Table 2 (Supplementary) Adverse Events by System Organ Class, High Level Term and Preferred Term Table 2
#'
#' The AET02_2 table provides an overview of the number of patients experiencing advert events and the number of advert
#' events categorized by Body System, High Level Term and Dictionary-Derived Term.
#' The `AET02_2` table provides an overview of the number of patients experiencing adverse events and the number of
#' adverse events categorized by Body System, High Level Term and Dictionary-Derived Term.
#'
#' @inheritParams gen_args
#'
Expand Down Expand Up @@ -201,9 +201,9 @@ aet02_2 <- function(adam_db,
lyt <- aet02_2_lyt(
armvar = armvar,
lbl_overall = lbl_overall,
lbl_AEBODSYS = var_labels_for(adae, "AEBODSYS"),
lbl_AEHLT = var_labels_for(adae, "AEHLT"),
lbl_AEDECOD = var_labels_for(adae, "AEDECOD"),
lbl_aebodsys = var_labels_for(adae, "AEBODSYS"),
lbl_aehlt = var_labels_for(adae, "AEHLT"),
lbl_aedecod = var_labels_for(adae, "AEDECOD"),
deco = deco
)

Expand Down Expand Up @@ -231,32 +231,32 @@ aet02_2 <- function(adam_db,
}


#' AET02 Layout 2 (Supplementary)
#' `AET02` Layout 2 (Supplementary)
#'
#' @describeIn aet02_2
#'
#' @inheritParams gen_args
#'
#' @param lbl_AEBODSYS (`string`) text label for AEBODSYS.
#' @param lbl_AEHLT (`string`) text label for AEHLT.
#' @param lbl_AEDECOD (`string`) text label for AEDECOD.
#' @param lbl_aebodsys (`character`) text label for `AEBODSYS`.
#' @param lbl_aehlt (`character`) text label for `AEHLT`.
#' @param lbl_aedecod (`character`) text label for `AEDECOD`.
#'
#' @export
#'
#' @examples
#' aet02_2_lyt(
#' armvar = "ACTARM",
#' lbl_overall = NULL,
#' lbl_AEBODSYS = "Body System or Organ Class",
#' lbl_AEHLT = "High Level Term",
#' lbl_AEDECOD = "Dictionary-Derived Term",
#' lbl_aebodsys = "Body System or Organ Class",
#' lbl_aehlt = "High Level Term",
#' lbl_aedecod = "Dictionary-Derived Term",
#' deco = std_deco("AET02")
#' )
aet02_2_lyt <- function(armvar = .study$armvar,
lbl_overall = .study$lbl_overall,
lbl_AEBODSYS = "AEBODSYS",
lbl_AEHLT = "AEHLT",
lbl_AEDECOD = "AEDECOD",
lbl_aebodsys = "AEBODSYS",
lbl_aehlt = "AEHLT",
lbl_aedecod = "AEDECOD",
deco = std_deco("AET02"),
.study = list(
armvar = "ACTARM",
Expand All @@ -282,7 +282,7 @@ aet02_2_lyt <- function(armvar = .study$armvar,
indent_mod = -1L,
split_fun = drop_split_levels,
label_pos = "topleft",
split_label = lbl_AEBODSYS
split_label = lbl_aebodsys
) %>%
summarize_num_patients(
var = "USUBJID",
Expand All @@ -298,7 +298,7 @@ aet02_2_lyt <- function(armvar = .study$armvar,
indent_mod = -1L,
split_fun = drop_split_levels,
label_pos = "topleft",
split_label = lbl_AEHLT
split_label = lbl_aehlt
) %>%
summarize_num_patients(
var = "USUBJID",
Expand All @@ -312,16 +312,16 @@ aet02_2_lyt <- function(armvar = .study$armvar,
vars = "AEDECOD",
.indent_mods = -1L
) %>%
append_topleft(paste0(" ", lbl_AEDECOD))
append_topleft(paste0(" ", lbl_aedecod))
}


# Version 3 ----

#' AET02 Table 3 (Supplementary) Adverse Events by Dictionary-Derived Term Table 3
#' `AET02` Table 3 (Supplementary) Adverse Events by Dictionary-Derived Term Table 3
#'
#' The AET02_3 table provides an overview of the number of patients experiencing advert events and the number of advert
#' events categorized by Dictionary-Derived Term.
#' The `AET02_3` table provides an overview of the number of patients experiencing adverse events and the number of
#' adverse events categorized by Dictionary-Derived Term.
#'
#' @inheritParams gen_args
#'
Expand Down Expand Up @@ -357,7 +357,7 @@ aet02_3 <- function(adam_db,
lyt <- aet02_3_lyt(
armvar = armvar,
lbl_overall = lbl_overall,
lbl_AEDECOD = var_labels_for(adam_db$adae, "AEDECOD"),
lbl_aedecod = var_labels_for(adam_db$adae, "AEDECOD"),
deco = deco
)

Expand All @@ -377,26 +377,26 @@ aet02_3 <- function(adam_db,
}


#' AET01 Layout 3 (Supplementary)
#' `AET02` Layout 3 (Supplementary)
#'
#' @describeIn aet02_3
#'
#' @inheritParams gen_args
#'
#' @param lbl_AEDECOD (`string`) text label for AEDECOD.
#' @param lbl_aedecod (`character`) text label for `AEDECOD`.
#'
#' @export
#'
#' @examples
#' aet02_3_lyt(
#' armvar = "ACTARM",
#' lbl_overall = NULL,
#' lbl_AEDECOD = "Dictionary-Derived Term",
#' lbl_aedecod = "Dictionary-Derived Term",
#' deco = std_deco("AET02")
#' )
aet02_3_lyt <- function(armvar = .study$armvar,
lbl_overall = .study$lbl_overall,
lbl_AEDECOD = "AEDECOD",
lbl_aedecod = "AEDECOD",
deco = std_deco("AET02"),
.study = list(
armvar = "ACTARM",
Expand All @@ -415,5 +415,5 @@ aet02_3_lyt <- function(armvar = .study$armvar,
)
) %>%
count_occurrences(vars = "AEDECOD", .indent_mods = -2L) %>%
append_topleft(lbl_AEDECOD)
append_topleft(lbl_aedecod)
}
36 changes: 18 additions & 18 deletions R/aet03.R
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@

#' AET03 Table 1 (Default) Advert Events by Greatest Intensity Table 1
#' `AET03` Table 1 (Default) Advert Events by Greatest Intensity Table 1
#'
#' An adverse events table categorized by System Organ Class, Dictionary-Derived Term and Greatest intensity.
#'
#' @inheritParams gen_args
#'
#' @details
#' * Default Adverse Events by Greatest Intensity table
#' * Numbers represent absolute numbers of patients and fraction of `N`
#' * Default Adverse Events by Greatest Intensity table.
#' * Numbers represent absolute numbers of patients and fraction of `N`.
#' * Remove zero-count rows unless overridden with `prune_0 = FALSE`.
#' * Split columns by arm
#' * Does not include a total column by default
#' * Sort by Body System or Organ Class (SOC) and Dictionary-Derived Term (PT)
#' * Split columns by arm.
#' * Does not include a total column by default.
#' * Sort by Body System or Organ Class (`SOC`) and Dictionary-Derived Term (`PT`).
#'
#' @importFrom dplyr filter
#' @importFrom magrittr %>%
Expand Down Expand Up @@ -46,8 +46,8 @@ aet03_1 <- function(adam_db,
lyt <- aet03_1_lyt(
armvar = armvar,
lbl_overall = lbl_overall,
lbl_AEBODSYS = var_labels_for(adam_db$adae, "AEBODSYS"),
lbl_AEDECOD = var_labels_for(adam_db$adae, "AEDECOD"),
lbl_aebodsys = var_labels_for(adam_db$adae, "AEBODSYS"),
lbl_aedecod = var_labels_for(adam_db$adae, "AEDECOD"),
severity_grade = severity_grade,
deco = deco
)
Expand Down Expand Up @@ -78,29 +78,29 @@ aet03_1 <- function(adam_db,
}


#' AET03 Layout 1 (Default)
#' `AET03` Layout 1 (Default)
#'
#' @describeIn aet03_1
#'
#' @inheritParams gen_args
#'
#' @param lbl_AEBODSYS (`string`) text label for AEBODSYS.
#' @param lbl_AEDECOD (`string`) text label for AEDECOD.
#' @param severity_grade (`vector of strings`) describing the severity levels present in the data set.
#' @param lbl_aebodsys (`character`) text label for `AEBODSYS`.
#' @param lbl_aedecod (`character`) text label for `AEDECOD`.
#' @param severity_grade (`vector of character`) describing the severity levels present in the data set.
#'
#' @export
#'
#' @examples
#' aet03_1_lyt(
#' armvar = "ACTARM",
#' lbl_AEBODSYS = "Body System or Organ Class",
#' lbl_AEDECOD = "Dictionary-Derived Term",
#' lbl_aebodsys = "Body System or Organ Class",
#' lbl_aedecod = "Dictionary-Derived Term",
#' lbl_overall = NULL,
#' deco = std_deco("AET03")
#' )
aet03_1_lyt <- function(armvar = .study$armvar,
lbl_AEBODSYS = "",
lbl_AEDECOD = "",
lbl_aebodsys = "",
lbl_aedecod = "",
severity_grade = .study$severity_grade,
lbl_overall = .study$lbl_overall,
deco = std_deco("AET03"),
Expand All @@ -124,7 +124,7 @@ aet03_1_lyt <- function(armvar = .study$armvar,
indent_mod = -1L,
split_fun = drop_split_levels,
label_pos = "topleft",
split_label = lbl_AEBODSYS
split_label = lbl_aebodsys
) %>%
summarize_occurrences_by_grade(
var = "AESEV",
Expand All @@ -137,7 +137,7 @@ aet03_1_lyt <- function(armvar = .study$armvar,
indent_mod = -1L,
split_fun = drop_split_levels,
label_pos = "topleft",
split_label = lbl_AEDECOD
split_label = lbl_aedecod
) %>%
summarize_occurrences_by_grade(
var = "AESEV",
Expand Down
Loading