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

Check in changes - DEVR-3489-fix-bugs-for-generating-title #207

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
5 changes: 4 additions & 1 deletion R/tlf_ae_exp_adj.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -42,6 +44,7 @@
#' )
tlf_ae_exp_adj <- function(outdata,
source,
analysis,
col_rel_width = NULL,
text_font_size = 9,
orientation = "portrait",
Expand All @@ -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
)
}
Expand Down
6 changes: 4 additions & 2 deletions R/tlf_ae_listing.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -45,14 +46,15 @@
tlf_ae_listing <- function(outdata,
footnotes = NULL,
source = NULL,
analysis,
col_rel_width = NULL,
text_font_size = 9,
orientation = "landscape",
path_outdata = NULL,
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)
Expand All @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion R/tlf_ae_specific.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -53,6 +54,7 @@
tlf_ae_specific <- function(outdata,
meddra_version,
source,
analysis,
col_rel_width = NULL,
text_font_size = 9,
orientation = "portrait",
Expand Down Expand Up @@ -99,7 +101,7 @@ tlf_ae_specific <- function(outdata,
outdata$population,
outdata$observation,
outdata$parameter,
analysis = "ae_specific",
analysis = analysis,
title_order = title
)

Expand Down
5 changes: 4 additions & 1 deletion R/tlf_ae_specific_subgroup.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -43,6 +45,7 @@ tlf_ae_specific_subgroup <- function(
outdata,
meddra_version,
source,
analysis,
col_rel_width = NULL,
text_font_size = 9,
orientation = "landscape",
Expand Down Expand Up @@ -94,7 +97,7 @@ tlf_ae_specific_subgroup <- function(
outdata$population,
outdata$observation,
outdata$parameter,
analysis = "ae_specific"
analysis = analysis
)
}

Expand Down
5 changes: 4 additions & 1 deletion R/tlf_ae_summary.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -40,6 +42,7 @@
#' )
tlf_ae_summary <- function(outdata,
source,
analysis,
col_rel_width = NULL,
text_font_size = 9,
orientation = "portrait",
Expand All @@ -63,7 +66,7 @@ tlf_ae_summary <- function(outdata,
outdata$population,
outdata$observation,
parameters[1],
analysis = "ae_summary",
analysis = analysis,
title_order = title
)
}
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-independent-testing-tlf-ae-listing.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-independent-testing-tlf_ae_exp_adj.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down Expand Up @@ -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
)
Expand Down
7 changes: 7 additions & 0 deletions tests/testthat/test-independent-testing-tlf_ae_specific.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand All @@ -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
)
Expand All @@ -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
)
Expand All @@ -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
Expand All @@ -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
)
Expand Down Expand Up @@ -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))
Expand All @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-independent-testing-tlf_ae_summary.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
1 change: 1 addition & 0 deletions vignettes/ae-listing.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
1 change: 1 addition & 0 deletions vignettes/ae-specific-subgroup.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
```
Expand Down
3 changes: 3 additions & 0 deletions vignettes/ae-specific.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
```
Expand All @@ -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",
Expand All @@ -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"
)
```
Expand Down
3 changes: 3 additions & 0 deletions vignettes/ae-summary.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
```
Expand All @@ -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",
Expand All @@ -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"
)
```
Expand Down
Loading