From 34536ae66fe0caa1d45f399aa5041523eec28645 Mon Sep 17 00:00:00 2001
From: *** Li Ma ***
Date: Tue, 29 Oct 2024 15:35:07 -0400
Subject: [PATCH 1/3] Check in changes -
DEVR-3489-fix-bugs-for-generating-title
---
R/tlf_ae_exp_adj.R | 5 ++++-
R/tlf_ae_listing.R | 6 ++++--
R/tlf_ae_specific.R | 4 +++-
R/tlf_ae_specific_subgroup.R | 5 ++++-
R/tlf_ae_summary.R | 5 ++++-
tests/testthat/test-independent-testing-tlf-ae-listing.R | 1 +
tests/testthat/test-independent-testing-tlf_ae_exp_adj.R | 2 ++
tests/testthat/test-independent-testing-tlf_ae_specific.R | 7 +++++++
.../test-independent-testing-tlf_ae_specific_subgroup.R | 1 +
tests/testthat/test-independent-testing-tlf_ae_summary.R | 1 +
vignettes/ae-listing.Rmd | 1 +
vignettes/ae-specific-subgroup.Rmd | 1 +
vignettes/ae-specific.Rmd | 3 +++
vignettes/ae-summary.Rmd | 3 +++
14 files changed, 39 insertions(+), 6 deletions(-)
diff --git a/R/tlf_ae_exp_adj.R b/R/tlf_ae_exp_adj.R
index 279154a..dea8f69 100644
--- a/R/tlf_ae_exp_adj.R
+++ b/R/tlf_ae_exp_adj.R
@@ -20,6 +20,8 @@
#'
#' @inheritParams tlf_ae_specific
#'
+#' @param analysis One of analysis name existing at `outdata$meta$analysis`
+#'
#' @return RTF file and source dataset for exposure-adjusted AE summary table.
#'
#' @export
@@ -42,6 +44,7 @@
#' )
tlf_ae_exp_adj <- function(outdata,
source,
+ analysis,
col_rel_width = NULL,
text_font_size = 9,
orientation = "portrait",
@@ -65,7 +68,7 @@ tlf_ae_exp_adj <- function(outdata,
outdata$population,
outdata$observation,
parameters[1],
- analysis = "ae_exp_adj",
+ analysis = analysis,
title_order = title
)
}
diff --git a/R/tlf_ae_listing.R b/R/tlf_ae_listing.R
index 34d302f..0a39b0d 100644
--- a/R/tlf_ae_listing.R
+++ b/R/tlf_ae_listing.R
@@ -21,6 +21,7 @@
#' @param outdata An `outdata` object created by [prepare_ae_listing()].
#' @param footnotes A character vector of table footnotes.
#' @param source A character value of the data source.
+#' @param analysis One of analysis name existing at `outdata$meta$analysis`
#' @inheritParams r2rtf::rtf_page
#' @inheritParams r2rtf::rtf_body
#' @param path_outdata A character string of the outdata path.
@@ -45,6 +46,7 @@
tlf_ae_listing <- function(outdata,
footnotes = NULL,
source = NULL,
+ analysis,
col_rel_width = NULL,
text_font_size = 9,
orientation = "landscape",
@@ -52,7 +54,7 @@ tlf_ae_listing <- function(outdata,
path_outtable = NULL) {
res <- outdata$tbl
- mapping <- collect_adam_mapping(outdata$meta, "ae_listing")
+ mapping <- collect_adam_mapping(outdata$meta, analysis)
var_name <- eval(mapping$var_name)
subline <- eval(mapping$subline)
subline_by <- eval(mapping$subline_by)
@@ -62,7 +64,7 @@ tlf_ae_listing <- function(outdata,
col_name <- outdata$col_name
# Define title
- title <- collect_title(outdata$meta, outdata$population, outdata$observation, outdata$parameter, analysis = "ae_listing")
+ title <- collect_title(outdata$meta, outdata$population, outdata$observation, outdata$parameter, analysis = analysis)
if (!nrow(res) == 0) {
res <- as.data.frame(res)
diff --git a/R/tlf_ae_specific.R b/R/tlf_ae_specific.R
index 50048f6..c8eac59 100644
--- a/R/tlf_ae_specific.R
+++ b/R/tlf_ae_specific.R
@@ -22,6 +22,7 @@
#' @param meddra_version A character value of the MedDRA version
#' for this dataset.
#' @param source A character value of the data source.
+#' @param analysis One of analysis name existing at `outdata$meta$analysis`
#' @inheritParams r2rtf::rtf_page
#' @inheritParams r2rtf::rtf_body
#' @param footnotes A character vector of table footnotes.
@@ -53,6 +54,7 @@
tlf_ae_specific <- function(outdata,
meddra_version,
source,
+ analysis,
col_rel_width = NULL,
text_font_size = 9,
orientation = "portrait",
@@ -99,7 +101,7 @@ tlf_ae_specific <- function(outdata,
outdata$population,
outdata$observation,
outdata$parameter,
- analysis = "ae_specific",
+ analysis = analysis,
title_order = title
)
diff --git a/R/tlf_ae_specific_subgroup.R b/R/tlf_ae_specific_subgroup.R
index b8996b1..3cf818f 100644
--- a/R/tlf_ae_specific_subgroup.R
+++ b/R/tlf_ae_specific_subgroup.R
@@ -20,6 +20,8 @@
#'
#' @inheritParams tlf_ae_specific
#'
+#' @param analysis One of analysis name existing at `outdata$meta$analysis`
+#'
#' @return RTF file and the source dataset for AE specific subgroup analysis table.
#'
#' @export
@@ -43,6 +45,7 @@ tlf_ae_specific_subgroup <- function(
outdata,
meddra_version,
source,
+ analysis,
col_rel_width = NULL,
text_font_size = 9,
orientation = "landscape",
@@ -94,7 +97,7 @@ tlf_ae_specific_subgroup <- function(
outdata$population,
outdata$observation,
outdata$parameter,
- analysis = "ae_specific"
+ analysis = analysis
)
}
diff --git a/R/tlf_ae_summary.R b/R/tlf_ae_summary.R
index f775090..f78ef47 100644
--- a/R/tlf_ae_summary.R
+++ b/R/tlf_ae_summary.R
@@ -20,6 +20,8 @@
#'
#' @inheritParams tlf_ae_specific
#'
+#' @param analysis One of analysis name existing at `outdata$meta$analysis`
+#'
#' @return RTF file and the source dataset for AE summary table.
#'
#' @export
@@ -40,6 +42,7 @@
#' )
tlf_ae_summary <- function(outdata,
source,
+ analysis,
col_rel_width = NULL,
text_font_size = 9,
orientation = "portrait",
@@ -63,7 +66,7 @@ tlf_ae_summary <- function(outdata,
outdata$population,
outdata$observation,
parameters[1],
- analysis = "ae_summary",
+ analysis = analysis,
title_order = title
)
}
diff --git a/tests/testthat/test-independent-testing-tlf-ae-listing.R b/tests/testthat/test-independent-testing-tlf-ae-listing.R
index be918c3..85fdb6c 100644
--- a/tests/testthat/test-independent-testing-tlf-ae-listing.R
+++ b/tests/testthat/test-independent-testing-tlf-ae-listing.R
@@ -15,6 +15,7 @@ tbl <- outdata |>
tlf_ae_listing(
footnotes = "footnote1",
source = "Source: [CDISCpilot: adam-adsl; adae]",
+ analysis = "ae_listing",
path_outdata = path_rdata,
path_outtable = path_rtf
)
diff --git a/tests/testthat/test-independent-testing-tlf_ae_exp_adj.R b/tests/testthat/test-independent-testing-tlf_ae_exp_adj.R
index e5bb24d..fbd4e84 100644
--- a/tests/testthat/test-independent-testing-tlf_ae_exp_adj.R
+++ b/tests/testthat/test-independent-testing-tlf_ae_exp_adj.R
@@ -21,6 +21,7 @@ test_that("rtf output: n, total_exp, events, eaer, total", {
) |>
tlf_ae_exp_adj(
source = "Source: [CDISCpilot: adam-adsl]",
+ analysis = "ae_exp_adj",
path_outdata = path_rdata,
path_outtable = path_rtf
)
@@ -51,6 +52,7 @@ test_that("rtf output: n, total_exp, events, eaer, total", {
) |>
tlf_ae_exp_adj(
source = "Source: [CDISCpilot: adam-adsl]",
+ analysis = "ae_exp_adj",
path_outdata = path_rdata,
path_outtable = path_rtf
)
diff --git a/tests/testthat/test-independent-testing-tlf_ae_specific.R b/tests/testthat/test-independent-testing-tlf_ae_specific.R
index fadf9f0..7841a6a 100644
--- a/tests/testthat/test-independent-testing-tlf_ae_specific.R
+++ b/tests/testthat/test-independent-testing-tlf_ae_specific.R
@@ -20,6 +20,7 @@ test_that("rtf output: events, dur, n, and prop w/o total", {
tlf_ae_specific(
meddra_version = "24.0",
source = "Source: [CDISCpilot: adam-adsl; adae]",
+ analysis = "ae_specific",
path_outdata = path_rdata,
path_outtable = path_rtf
)
@@ -41,6 +42,7 @@ test_that("rtf output: events, dur, n, and prop w/ total", {
tlf_ae_specific(
meddra_version = "24.0",
source = "Source: [CDISCpilot: adam-adsl; adae]",
+ analysis = "ae_specific",
path_outdata = path_rdata,
path_outtable = path_rtf
)
@@ -64,6 +66,7 @@ test_that("rtf output: diff, events, dur, n, and prop w/o total", {
tlf_ae_specific(
meddra_version = "24.0",
source = "Source: [CDISCpilot: adam-adsl; adae]",
+ analysis = "ae_specific",
path_outdata = path_rdata,
path_outtable = path_rtf
)
@@ -86,6 +89,7 @@ test_that("rtf output: diff, events, dur, n, and prop w/ total", {
tlf_ae_specific(
meddra_version = "24.0",
source = "Source: [CDISCpilot: adam-adsl; adae]",
+ analysis = "ae_specific",
col_rel_width = c(5, rep(c(1, 2, 3, 3), 4), 1, 2, 3, 1, 2, 3),
path_outdata = path_rdata,
path_outtable = path_rtf
@@ -111,6 +115,7 @@ test_that("rtf output: events, dur, n, and prop w/ total", {
tlf_ae_specific(
meddra_version = "24.0",
source = "Source: [CDISCpilot: adam-adsl; adae]",
+ analysis = "ae_specific",
path_outdata = path_rdata,
path_outtable = path_rtf
)
@@ -166,6 +171,7 @@ test_that("relative width 'works'", {
tlf_ae_specific(
meddra_version = "24.0",
source = "Source: [CDISCpilot: adam-adsl; adae]",
+ analysis = "ae_specific",
path_outdata = path_rdata,
path_outtable = path_rtf,
col_rel_width = c(rep(1, 8))
@@ -181,6 +187,7 @@ test_that("relative width 'works'", {
tlf_ae_specific(
meddra_version = "24.0",
source = "Source: [CDISCpilot: adam-adsl; adae]",
+ analysis = "ae_specific",
path_outdata = path_rdata,
path_outtable = path_rtf,
col_rel_width = c(rep(1, 7))
diff --git a/tests/testthat/test-independent-testing-tlf_ae_specific_subgroup.R b/tests/testthat/test-independent-testing-tlf_ae_specific_subgroup.R
index 2ea6011..11b82c7 100644
--- a/tests/testthat/test-independent-testing-tlf_ae_specific_subgroup.R
+++ b/tests/testthat/test-independent-testing-tlf_ae_specific_subgroup.R
@@ -18,6 +18,7 @@ test_that("rtf output: n, and prop w/o total", {
tlf_ae_specific_subgroup(
meddra_version = "24.0",
source = "Source: [CDISCpilot: adam-adsl; adae]",
+ analysis = "ae_specific",
# path_outdata = path_rdata,
path_outtable = path_rtf
)
diff --git a/tests/testthat/test-independent-testing-tlf_ae_summary.R b/tests/testthat/test-independent-testing-tlf_ae_summary.R
index f7cf8e5..65335af 100644
--- a/tests/testthat/test-independent-testing-tlf_ae_summary.R
+++ b/tests/testthat/test-independent-testing-tlf_ae_summary.R
@@ -14,6 +14,7 @@ tbl <- outdata |>
format_ae_summary() |>
tlf_ae_summary(
source = "Source: [CDISCpilot: adam-adsl; adae]",
+ analysis = "ae_summary",
path_outtable = path_rtf,
path_outdata = path_rdata
)
diff --git a/vignettes/ae-listing.Rmd b/vignettes/ae-listing.Rmd
index 836ea9c..c05f40b 100644
--- a/vignettes/ae-listing.Rmd
+++ b/vignettes/ae-listing.Rmd
@@ -101,6 +101,7 @@ tbl |> tlf_ae_listing(
footnotes = footnote,
orientation = "portrait",
source = "Source: [CDISCpilot: adam-adsl; adae]",
+ analysis = "ae_listing",
path_outtable = "rtf/ae0listing0ser0wk12.rtf",
path_outdata = NULL
)
diff --git a/vignettes/ae-specific-subgroup.Rmd b/vignettes/ae-specific-subgroup.Rmd
index ad6a212..d55fa0a 100644
--- a/vignettes/ae-specific-subgroup.Rmd
+++ b/vignettes/ae-specific-subgroup.Rmd
@@ -161,6 +161,7 @@ outdata |>
tlf_ae_specific_subgroup(
meddra_version = "24.0",
source = "Source: [CDISCpilot: adam-adsl; adae]",
+ analysis = "ae_specific",
path_outtable = "rtf/ae0specific0sub0gender1.rtf"
)
```
diff --git a/vignettes/ae-specific.Rmd b/vignettes/ae-specific.Rmd
index 9b994b2..e421190 100644
--- a/vignettes/ae-specific.Rmd
+++ b/vignettes/ae-specific.Rmd
@@ -255,6 +255,7 @@ outdata |>
tlf_ae_specific(
meddra_version = "24.0",
source = "Source: [CDISCpilot: adam-adsl; adae]",
+ analysis = "ae_specific",
path_outtable = "rtf/ae0specific1.rtf"
)
```
@@ -272,6 +273,7 @@ outdata |>
tlf_ae_specific(
meddra_version = "24.0",
source = "Source: [CDISCpilot: adam-adsl; adae]",
+ analysis = "ae_specific",
col_rel_width = c(6, rep(1, 8)),
text_font_size = 8,
orientation = "landscape",
@@ -291,6 +293,7 @@ outdata |>
tlf_ae_specific(
meddra_version = "24.0",
source = "Source: [CDISCpilot: adam-adsl; adae]",
+ analysis = "ae_specific",
path_outtable = "rtf/mock_ae0specific1.rtf"
)
```
diff --git a/vignettes/ae-summary.Rmd b/vignettes/ae-summary.Rmd
index 5bf3849..3a2495e 100644
--- a/vignettes/ae-summary.Rmd
+++ b/vignettes/ae-summary.Rmd
@@ -187,6 +187,7 @@ outdata |>
format_ae_summary() |>
tlf_ae_summary(
source = "Source: [CDISCpilot: adam-adsl; adae]",
+ analysis = "ae_summary",
path_outtable = "rtf/ae0summary1.rtf"
)
```
@@ -202,6 +203,7 @@ outdata |>
format_ae_summary() |>
tlf_ae_summary(
source = "Source: [CDISCpilot: adam-adsl; adae]",
+ analysis = "ae_summary",
col_rel_width = c(6, rep(1, 8)),
text_font_size = 8,
orientation = "landscape",
@@ -228,6 +230,7 @@ outdata |>
format_ae_summary(mock = TRUE) |>
tlf_ae_summary(
source = "Source: [CDISCpilot: adam-adsl; adae]",
+ analysis = "ae_summary",
path_outtable = "rtf/mock_ae0summary1.rtf"
)
```
From 710c7cd6ff4effc6411b130564f78d6c0c54b846 Mon Sep 17 00:00:00 2001
From: *** Li Ma ***
Date: Mon, 4 Nov 2024 12:22:02 -0500
Subject: [PATCH 2/3] Check in changes (2nd time) -
DEVR-3489-fix-bugs-for-generating-title
---
DESCRIPTION | 2 +-
R/tlf_ae_exp_adj.R | 10 ++++++++++
R/tlf_ae_listing.R | 10 ++++++++++
R/tlf_ae_specific.R | 10 ++++++++++
R/tlf_ae_specific_subgroup.R | 10 ++++++++++
R/tlf_ae_summary.R | 10 ++++++++++
man/tlf_ae_exp_adj.Rd | 4 ++++
man/tlf_ae_listing.Rd | 4 ++++
man/tlf_ae_specific.Rd | 4 ++++
man/tlf_ae_specific_subgroup.Rd | 4 ++++
man/tlf_ae_summary.Rd | 4 ++++
tests/testthat/test-independent-testing-empty_table.R | 2 ++
vignettes/ae-listing.Rmd | 2 +-
vignettes/ae-specific-subgroup.Rmd | 2 +-
vignettes/ae-specific.Rmd | 6 +++---
vignettes/ae-summary.Rmd | 6 +++---
vignettes/metalite-ae.Rmd | 1 +
17 files changed, 82 insertions(+), 9 deletions(-)
diff --git a/DESCRIPTION b/DESCRIPTION
index 523b1a7..b3659bd 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -47,4 +47,4 @@ Suggests:
tidyr
Config/testthat/edition: 3
Roxygen: list(markdown = TRUE)
-RoxygenNote: 7.3.1
+RoxygenNote: 7.3.2
diff --git a/R/tlf_ae_exp_adj.R b/R/tlf_ae_exp_adj.R
index dea8f69..eeec004 100644
--- a/R/tlf_ae_exp_adj.R
+++ b/R/tlf_ae_exp_adj.R
@@ -39,6 +39,7 @@
#' format_ae_exp_adj() |>
#' tlf_ae_exp_adj(
#' source = "Source: [CDISCpilot: adam-adsl; adae]",
+#' analysis = "ae_exp_adj",
#' path_outdata = tempfile(fileext = ".Rdata"),
#' path_outtable = tempfile(fileext = ".rtf")
#' )
@@ -59,6 +60,15 @@ tlf_ae_exp_adj <- function(outdata,
n_row <- nrow(tbl)
n_col <- ncol(tbl)
+ # Check if the parameter analysis contains the correct analysis that should exist in "outdata$meta$analysis"
+ analysis_name <- names(outdata$meta$analysis)
+ if (!(analysis %in% analysis_name)) {
+ stop(
+ "Please provide a valid analysis that matches with what being defined in 'outdata$meta$analysis'",
+ call. = FALSE
+ )
+ }
+
parameters <- unlist(strsplit(outdata$parameter, ";"))
# Title
diff --git a/R/tlf_ae_listing.R b/R/tlf_ae_listing.R
index 0a39b0d..76e5d8d 100644
--- a/R/tlf_ae_listing.R
+++ b/R/tlf_ae_listing.R
@@ -40,6 +40,7 @@
#' tlf_ae_listing(
#' footnotes = "footnote1",
#' source = "Source: [CDISCpilot: adam-adsl; adae]",
+#' analysis = "ae_listing",
#' path_outdata = tempfile(fileext = ".Rdata"),
#' path_outtable = tempfile(fileext = ".rtf")
#' )
@@ -54,6 +55,15 @@ tlf_ae_listing <- function(outdata,
path_outtable = NULL) {
res <- outdata$tbl
+ # Check if the parameter analysis contains the correct analysis that should exist in "outdata$meta$analysis"
+ analysis_name <- names(outdata$meta$analysis)
+ if (!(analysis %in% analysis_name)) {
+ stop(
+ "Please provide a valid analysis that matches with what being defined in 'outdata$meta$analysis'",
+ call. = FALSE
+ )
+ }
+
mapping <- collect_adam_mapping(outdata$meta, analysis)
var_name <- eval(mapping$var_name)
subline <- eval(mapping$subline)
diff --git a/R/tlf_ae_specific.R b/R/tlf_ae_specific.R
index c8eac59..cadcb0c 100644
--- a/R/tlf_ae_specific.R
+++ b/R/tlf_ae_specific.R
@@ -47,6 +47,7 @@
#' format_ae_specific() |>
#' tlf_ae_specific(
#' source = "Source: [CDISCpilot: adam-adsl; adae]",
+#' analysis = "ae_specific",
#' meddra_version = "24.0",
#' path_outdata = tempfile(fileext = ".Rdata"),
#' path_outtable = tempfile(fileext = ".rtf")
@@ -94,6 +95,15 @@ tlf_ae_specific <- function(outdata,
)
}
+ # Check if the parameter analysis contains the correct analysis that should exist in "outdata$meta$analysis"
+ analysis_name <- names(outdata$meta$analysis)
+ if (!(analysis %in% analysis_name)) {
+ stop(
+ "Please provide a valid analysis that matches with what being defined in 'outdata$meta$analysis'",
+ call. = FALSE
+ )
+ }
+
# Define title
if ("analysis" %in% title | "observation" %in% title | "population" %in% title) {
title_key <- title
diff --git a/R/tlf_ae_specific_subgroup.R b/R/tlf_ae_specific_subgroup.R
index 3cf818f..014af3a 100644
--- a/R/tlf_ae_specific_subgroup.R
+++ b/R/tlf_ae_specific_subgroup.R
@@ -39,6 +39,7 @@
#' tlf_ae_specific_subgroup(
#' meddra_version = "24.0",
#' source = "Source: [CDISCpilot: adam-adsl; adae]",
+#' analysis = "ae_specific",
#' path_outtable = tempfile(fileext = ".rtf")
#' )
tlf_ae_specific_subgroup <- function(
@@ -91,6 +92,15 @@ tlf_ae_specific_subgroup <- function(
)
}
+ # Check if the parameter analysis contains the correct analysis that should exist in "outdata$meta$analysis"
+ analysis_name <- names(outdata$meta$analysis)
+ if (!(analysis %in% analysis_name)) {
+ stop(
+ "Please provide a valid analysis that matches with what being defined in 'outdata$meta$analysis'",
+ call. = FALSE
+ )
+ }
+
# Define title
if (is.null(title)) {
title <- collect_title(outdata$meta,
diff --git a/R/tlf_ae_summary.R b/R/tlf_ae_summary.R
index f78ef47..61a04c9 100644
--- a/R/tlf_ae_summary.R
+++ b/R/tlf_ae_summary.R
@@ -37,6 +37,7 @@
#' format_ae_summary() |>
#' tlf_ae_summary(
#' source = "Source: [CDISCpilot: adam-adsl; adae]",
+#' analysis = "ae_summary",
#' path_outdata = tempfile(fileext = ".Rdata"),
#' path_outtable = tempfile(fileext = ".rtf")
#' )
@@ -57,6 +58,15 @@ tlf_ae_summary <- function(outdata,
n_row <- nrow(tbl)
n_col <- ncol(tbl)
+ # Check if the parameter analysis contains the correct analysis that should exist in "outdata$meta$analysis"
+ analysis_name <- names(outdata$meta$analysis)
+ if (!(analysis %in% analysis_name)) {
+ stop(
+ "Please provide a valid analysis that matches with what being defined in 'outdata$meta$analysis'",
+ call. = FALSE
+ )
+ }
+
parameters <- unlist(strsplit(outdata$parameter, ";"))
# Title
diff --git a/man/tlf_ae_exp_adj.Rd b/man/tlf_ae_exp_adj.Rd
index b575f3c..b621cce 100644
--- a/man/tlf_ae_exp_adj.Rd
+++ b/man/tlf_ae_exp_adj.Rd
@@ -7,6 +7,7 @@
tlf_ae_exp_adj(
outdata,
source,
+ analysis,
col_rel_width = NULL,
text_font_size = 9,
orientation = "portrait",
@@ -21,6 +22,8 @@ tlf_ae_exp_adj(
\item{source}{A character value of the data source.}
+\item{analysis}{One of analysis name existing at \code{outdata$meta$analysis}}
+
\item{col_rel_width}{Column relative width in a vector e.g. c(2,1,1) refers to 2:1:1.
Default is NULL for equal column width.}
@@ -58,6 +61,7 @@ outdata |>
format_ae_exp_adj() |>
tlf_ae_exp_adj(
source = "Source: [CDISCpilot: adam-adsl; adae]",
+ analysis = "ae_exp_adj",
path_outdata = tempfile(fileext = ".Rdata"),
path_outtable = tempfile(fileext = ".rtf")
)
diff --git a/man/tlf_ae_listing.Rd b/man/tlf_ae_listing.Rd
index a56788b..9857acd 100644
--- a/man/tlf_ae_listing.Rd
+++ b/man/tlf_ae_listing.Rd
@@ -8,6 +8,7 @@ tlf_ae_listing(
outdata,
footnotes = NULL,
source = NULL,
+ analysis,
col_rel_width = NULL,
text_font_size = 9,
orientation = "landscape",
@@ -22,6 +23,8 @@ tlf_ae_listing(
\item{source}{A character value of the data source.}
+\item{analysis}{One of analysis name existing at \code{outdata$meta$analysis}}
+
\item{col_rel_width}{Column relative width in a vector e.g. c(2,1,1) refers to 2:1:1.
Default is NULL for equal column width.}
@@ -50,6 +53,7 @@ prepare_ae_listing(meta, "ae_listing", "apat", "wk12", "ser") |>
tlf_ae_listing(
footnotes = "footnote1",
source = "Source: [CDISCpilot: adam-adsl; adae]",
+ analysis = "ae_listing",
path_outdata = tempfile(fileext = ".Rdata"),
path_outtable = tempfile(fileext = ".rtf")
)
diff --git a/man/tlf_ae_specific.Rd b/man/tlf_ae_specific.Rd
index 99559a8..7668b74 100644
--- a/man/tlf_ae_specific.Rd
+++ b/man/tlf_ae_specific.Rd
@@ -8,6 +8,7 @@ tlf_ae_specific(
outdata,
meddra_version,
source,
+ analysis,
col_rel_width = NULL,
text_font_size = 9,
orientation = "portrait",
@@ -25,6 +26,8 @@ for this dataset.}
\item{source}{A character value of the data source.}
+\item{analysis}{One of analysis name existing at \code{outdata$meta$analysis}}
+
\item{col_rel_width}{Column relative width in a vector e.g. c(2,1,1) refers to 2:1:1.
Default is NULL for equal column width.}
@@ -61,6 +64,7 @@ meta |>
format_ae_specific() |>
tlf_ae_specific(
source = "Source: [CDISCpilot: adam-adsl; adae]",
+ analysis = "ae_specific",
meddra_version = "24.0",
path_outdata = tempfile(fileext = ".Rdata"),
path_outtable = tempfile(fileext = ".rtf")
diff --git a/man/tlf_ae_specific_subgroup.Rd b/man/tlf_ae_specific_subgroup.Rd
index f8e181d..10209af 100644
--- a/man/tlf_ae_specific_subgroup.Rd
+++ b/man/tlf_ae_specific_subgroup.Rd
@@ -8,6 +8,7 @@ tlf_ae_specific_subgroup(
outdata,
meddra_version,
source,
+ analysis,
col_rel_width = NULL,
text_font_size = 9,
orientation = "landscape",
@@ -25,6 +26,8 @@ for this dataset.}
\item{source}{A character value of the data source.}
+\item{analysis}{One of analysis name existing at \code{outdata$meta$analysis}}
+
\item{col_rel_width}{Column relative width in a vector e.g. c(2,1,1) refers to 2:1:1.
Default is NULL for equal column width.}
@@ -62,6 +65,7 @@ prepare_ae_specific_subgroup(meta,
tlf_ae_specific_subgroup(
meddra_version = "24.0",
source = "Source: [CDISCpilot: adam-adsl; adae]",
+ analysis = "ae_specific",
path_outtable = tempfile(fileext = ".rtf")
)
}
diff --git a/man/tlf_ae_summary.Rd b/man/tlf_ae_summary.Rd
index ff52ef2..c7cfc2f 100644
--- a/man/tlf_ae_summary.Rd
+++ b/man/tlf_ae_summary.Rd
@@ -7,6 +7,7 @@
tlf_ae_summary(
outdata,
source,
+ analysis,
col_rel_width = NULL,
text_font_size = 9,
orientation = "portrait",
@@ -21,6 +22,8 @@ tlf_ae_summary(
\item{source}{A character value of the data source.}
+\item{analysis}{One of analysis name existing at \code{outdata$meta$analysis}}
+
\item{col_rel_width}{Column relative width in a vector e.g. c(2,1,1) refers to 2:1:1.
Default is NULL for equal column width.}
@@ -56,6 +59,7 @@ outdata |>
format_ae_summary() |>
tlf_ae_summary(
source = "Source: [CDISCpilot: adam-adsl; adae]",
+ analysis = "ae_summary",
path_outdata = tempfile(fileext = ".Rdata"),
path_outtable = tempfile(fileext = ".rtf")
)
diff --git a/tests/testthat/test-independent-testing-empty_table.R b/tests/testthat/test-independent-testing-empty_table.R
index 0e6ec38..2f23b8a 100644
--- a/tests/testthat/test-independent-testing-empty_table.R
+++ b/tests/testthat/test-independent-testing-empty_table.R
@@ -39,6 +39,7 @@ generate_analysis_or_empty <- function(meta, outdata) {
) |>
tlf_ae_specific(
source = "Source: [CDISCpilot: adam-adsl; adae]",
+ analysis = "ae_specific",
meddra_version = "24.0",
path_outdata = path_rdata,
path_outtable = path_rtf
@@ -74,6 +75,7 @@ test_that("RTF output: empty table or analysis table.", {
) |>
tlf_ae_specific(
source = "Source: [CDISCpilot: adam-adsl; adae]",
+ analysis = "ae_specific",
meddra_version = "24.0",
path_outdata = path_rdata,
path_outtable = path_rtf
diff --git a/vignettes/ae-listing.Rmd b/vignettes/ae-listing.Rmd
index c05f40b..7cc0d6d 100644
--- a/vignettes/ae-listing.Rmd
+++ b/vignettes/ae-listing.Rmd
@@ -101,7 +101,7 @@ tbl |> tlf_ae_listing(
footnotes = footnote,
orientation = "portrait",
source = "Source: [CDISCpilot: adam-adsl; adae]",
- analysis = "ae_listing",
+ analysis = "ae_listing", # Provide analysis type defined in meta$analysis
path_outtable = "rtf/ae0listing0ser0wk12.rtf",
path_outdata = NULL
)
diff --git a/vignettes/ae-specific-subgroup.Rmd b/vignettes/ae-specific-subgroup.Rmd
index d55fa0a..896811b 100644
--- a/vignettes/ae-specific-subgroup.Rmd
+++ b/vignettes/ae-specific-subgroup.Rmd
@@ -161,7 +161,7 @@ outdata |>
tlf_ae_specific_subgroup(
meddra_version = "24.0",
source = "Source: [CDISCpilot: adam-adsl; adae]",
- analysis = "ae_specific",
+ analysis = "ae_specific", # Provide analysis type defined in meta$analysis
path_outtable = "rtf/ae0specific0sub0gender1.rtf"
)
```
diff --git a/vignettes/ae-specific.Rmd b/vignettes/ae-specific.Rmd
index e421190..bc664fc 100644
--- a/vignettes/ae-specific.Rmd
+++ b/vignettes/ae-specific.Rmd
@@ -255,7 +255,7 @@ outdata |>
tlf_ae_specific(
meddra_version = "24.0",
source = "Source: [CDISCpilot: adam-adsl; adae]",
- analysis = "ae_specific",
+ analysis = "ae_specific", # Provide analysis type defined in meta$analysis
path_outtable = "rtf/ae0specific1.rtf"
)
```
@@ -273,7 +273,7 @@ outdata |>
tlf_ae_specific(
meddra_version = "24.0",
source = "Source: [CDISCpilot: adam-adsl; adae]",
- analysis = "ae_specific",
+ analysis = "ae_specific", # Provide analysis type defined in meta$analysis
col_rel_width = c(6, rep(1, 8)),
text_font_size = 8,
orientation = "landscape",
@@ -293,7 +293,7 @@ outdata |>
tlf_ae_specific(
meddra_version = "24.0",
source = "Source: [CDISCpilot: adam-adsl; adae]",
- analysis = "ae_specific",
+ analysis = "ae_specific", # Provide analysis type defined in meta$analysis
path_outtable = "rtf/mock_ae0specific1.rtf"
)
```
diff --git a/vignettes/ae-summary.Rmd b/vignettes/ae-summary.Rmd
index 3a2495e..4a1a822 100644
--- a/vignettes/ae-summary.Rmd
+++ b/vignettes/ae-summary.Rmd
@@ -187,7 +187,7 @@ outdata |>
format_ae_summary() |>
tlf_ae_summary(
source = "Source: [CDISCpilot: adam-adsl; adae]",
- analysis = "ae_summary",
+ analysis = "ae_summary", # Provide analysis type defined in meta$analysis
path_outtable = "rtf/ae0summary1.rtf"
)
```
@@ -203,7 +203,7 @@ outdata |>
format_ae_summary() |>
tlf_ae_summary(
source = "Source: [CDISCpilot: adam-adsl; adae]",
- analysis = "ae_summary",
+ analysis = "ae_summary", # Provide analysis type defined in meta$analysis
col_rel_width = c(6, rep(1, 8)),
text_font_size = 8,
orientation = "landscape",
@@ -230,7 +230,7 @@ outdata |>
format_ae_summary(mock = TRUE) |>
tlf_ae_summary(
source = "Source: [CDISCpilot: adam-adsl; adae]",
- analysis = "ae_summary",
+ analysis = "ae_summary", # Provide analysis type defined in meta$analysis
path_outtable = "rtf/mock_ae0summary1.rtf"
)
```
diff --git a/vignettes/metalite-ae.Rmd b/vignettes/metalite-ae.Rmd
index eea88bd..d46e902 100644
--- a/vignettes/metalite-ae.Rmd
+++ b/vignettes/metalite-ae.Rmd
@@ -89,6 +89,7 @@ meta_ae_example() |> # Example AE data created using metalite
format_ae_summary() |>
tlf_ae_summary(
source = "Source: [CDISCpilot: adam-adsl; adae]", # Define data source
+ analysis = "ae_specific", # Provide analysis type defined in meta$analysis
path_outtable = "ae0summary.rtf" # Define output
)
```
From 0fa576e70631be2b0432ab58fd9e4c82013a705c Mon Sep 17 00:00:00 2001
From: lm3388
Date: Mon, 4 Nov 2024 17:25:31 +0000
Subject: [PATCH 3/3] Style code (GHA)
---
R/tlf_ae_exp_adj.R | 2 +-
R/tlf_ae_listing.R | 2 +-
R/tlf_ae_specific.R | 2 +-
R/tlf_ae_specific_subgroup.R | 2 +-
R/tlf_ae_summary.R | 2 +-
vignettes/ae-listing.Rmd | 2 +-
vignettes/ae-specific-subgroup.Rmd | 2 +-
vignettes/ae-specific.Rmd | 6 +++---
vignettes/ae-summary.Rmd | 6 +++---
9 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/R/tlf_ae_exp_adj.R b/R/tlf_ae_exp_adj.R
index eeec004..bf8ba24 100644
--- a/R/tlf_ae_exp_adj.R
+++ b/R/tlf_ae_exp_adj.R
@@ -62,7 +62,7 @@ tlf_ae_exp_adj <- function(outdata,
# Check if the parameter analysis contains the correct analysis that should exist in "outdata$meta$analysis"
analysis_name <- names(outdata$meta$analysis)
- if (!(analysis %in% analysis_name)) {
+ if (!(analysis %in% analysis_name)) {
stop(
"Please provide a valid analysis that matches with what being defined in 'outdata$meta$analysis'",
call. = FALSE
diff --git a/R/tlf_ae_listing.R b/R/tlf_ae_listing.R
index 76e5d8d..5c4176e 100644
--- a/R/tlf_ae_listing.R
+++ b/R/tlf_ae_listing.R
@@ -57,7 +57,7 @@ tlf_ae_listing <- function(outdata,
# Check if the parameter analysis contains the correct analysis that should exist in "outdata$meta$analysis"
analysis_name <- names(outdata$meta$analysis)
- if (!(analysis %in% analysis_name)) {
+ if (!(analysis %in% analysis_name)) {
stop(
"Please provide a valid analysis that matches with what being defined in 'outdata$meta$analysis'",
call. = FALSE
diff --git a/R/tlf_ae_specific.R b/R/tlf_ae_specific.R
index cadcb0c..757a686 100644
--- a/R/tlf_ae_specific.R
+++ b/R/tlf_ae_specific.R
@@ -97,7 +97,7 @@ tlf_ae_specific <- function(outdata,
# Check if the parameter analysis contains the correct analysis that should exist in "outdata$meta$analysis"
analysis_name <- names(outdata$meta$analysis)
- if (!(analysis %in% analysis_name)) {
+ if (!(analysis %in% analysis_name)) {
stop(
"Please provide a valid analysis that matches with what being defined in 'outdata$meta$analysis'",
call. = FALSE
diff --git a/R/tlf_ae_specific_subgroup.R b/R/tlf_ae_specific_subgroup.R
index 014af3a..3043d4b 100644
--- a/R/tlf_ae_specific_subgroup.R
+++ b/R/tlf_ae_specific_subgroup.R
@@ -94,7 +94,7 @@ tlf_ae_specific_subgroup <- function(
# Check if the parameter analysis contains the correct analysis that should exist in "outdata$meta$analysis"
analysis_name <- names(outdata$meta$analysis)
- if (!(analysis %in% analysis_name)) {
+ if (!(analysis %in% analysis_name)) {
stop(
"Please provide a valid analysis that matches with what being defined in 'outdata$meta$analysis'",
call. = FALSE
diff --git a/R/tlf_ae_summary.R b/R/tlf_ae_summary.R
index 61a04c9..1282bfd 100644
--- a/R/tlf_ae_summary.R
+++ b/R/tlf_ae_summary.R
@@ -60,7 +60,7 @@ tlf_ae_summary <- function(outdata,
# Check if the parameter analysis contains the correct analysis that should exist in "outdata$meta$analysis"
analysis_name <- names(outdata$meta$analysis)
- if (!(analysis %in% analysis_name)) {
+ if (!(analysis %in% analysis_name)) {
stop(
"Please provide a valid analysis that matches with what being defined in 'outdata$meta$analysis'",
call. = FALSE
diff --git a/vignettes/ae-listing.Rmd b/vignettes/ae-listing.Rmd
index 7cc0d6d..e337b1d 100644
--- a/vignettes/ae-listing.Rmd
+++ b/vignettes/ae-listing.Rmd
@@ -101,7 +101,7 @@ tbl |> tlf_ae_listing(
footnotes = footnote,
orientation = "portrait",
source = "Source: [CDISCpilot: adam-adsl; adae]",
- analysis = "ae_listing", # Provide analysis type defined in meta$analysis
+ analysis = "ae_listing", # Provide analysis type defined in meta$analysis
path_outtable = "rtf/ae0listing0ser0wk12.rtf",
path_outdata = NULL
)
diff --git a/vignettes/ae-specific-subgroup.Rmd b/vignettes/ae-specific-subgroup.Rmd
index 896811b..22b5069 100644
--- a/vignettes/ae-specific-subgroup.Rmd
+++ b/vignettes/ae-specific-subgroup.Rmd
@@ -161,7 +161,7 @@ outdata |>
tlf_ae_specific_subgroup(
meddra_version = "24.0",
source = "Source: [CDISCpilot: adam-adsl; adae]",
- analysis = "ae_specific", # Provide analysis type defined in meta$analysis
+ analysis = "ae_specific", # Provide analysis type defined in meta$analysis
path_outtable = "rtf/ae0specific0sub0gender1.rtf"
)
```
diff --git a/vignettes/ae-specific.Rmd b/vignettes/ae-specific.Rmd
index bc664fc..f0fe08e 100644
--- a/vignettes/ae-specific.Rmd
+++ b/vignettes/ae-specific.Rmd
@@ -255,7 +255,7 @@ outdata |>
tlf_ae_specific(
meddra_version = "24.0",
source = "Source: [CDISCpilot: adam-adsl; adae]",
- analysis = "ae_specific", # Provide analysis type defined in meta$analysis
+ analysis = "ae_specific", # Provide analysis type defined in meta$analysis
path_outtable = "rtf/ae0specific1.rtf"
)
```
@@ -273,7 +273,7 @@ outdata |>
tlf_ae_specific(
meddra_version = "24.0",
source = "Source: [CDISCpilot: adam-adsl; adae]",
- analysis = "ae_specific", # Provide analysis type defined in meta$analysis
+ analysis = "ae_specific", # Provide analysis type defined in meta$analysis
col_rel_width = c(6, rep(1, 8)),
text_font_size = 8,
orientation = "landscape",
@@ -293,7 +293,7 @@ outdata |>
tlf_ae_specific(
meddra_version = "24.0",
source = "Source: [CDISCpilot: adam-adsl; adae]",
- analysis = "ae_specific", # Provide analysis type defined in meta$analysis
+ analysis = "ae_specific", # Provide analysis type defined in meta$analysis
path_outtable = "rtf/mock_ae0specific1.rtf"
)
```
diff --git a/vignettes/ae-summary.Rmd b/vignettes/ae-summary.Rmd
index 4a1a822..8cc0857 100644
--- a/vignettes/ae-summary.Rmd
+++ b/vignettes/ae-summary.Rmd
@@ -187,7 +187,7 @@ outdata |>
format_ae_summary() |>
tlf_ae_summary(
source = "Source: [CDISCpilot: adam-adsl; adae]",
- analysis = "ae_summary", # Provide analysis type defined in meta$analysis
+ analysis = "ae_summary", # Provide analysis type defined in meta$analysis
path_outtable = "rtf/ae0summary1.rtf"
)
```
@@ -203,7 +203,7 @@ outdata |>
format_ae_summary() |>
tlf_ae_summary(
source = "Source: [CDISCpilot: adam-adsl; adae]",
- analysis = "ae_summary", # Provide analysis type defined in meta$analysis
+ analysis = "ae_summary", # Provide analysis type defined in meta$analysis
col_rel_width = c(6, rep(1, 8)),
text_font_size = 8,
orientation = "landscape",
@@ -230,7 +230,7 @@ outdata |>
format_ae_summary(mock = TRUE) |>
tlf_ae_summary(
source = "Source: [CDISCpilot: adam-adsl; adae]",
- analysis = "ae_summary", # Provide analysis type defined in meta$analysis
+ analysis = "ae_summary", # Provide analysis type defined in meta$analysis
path_outtable = "rtf/mock_ae0summary1.rtf"
)
```