Skip to content

Commit

Permalink
processing maps, intended use vignette, introduction vignette
Browse files Browse the repository at this point in the history

Co-authored-by: benoit <[email protected]>
Co-authored-by: Adrian Waddell <[email protected]>
  • Loading branch information
3 people authored Dec 9, 2021
1 parent 6a87f4e commit 7b4ef11
Show file tree
Hide file tree
Showing 53 changed files with 1,576 additions and 660 deletions.
6 changes: 4 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@ Imports:
rlang,
rtables,
tidyr,
tibble
tibble,
methods
Suggests:
DiagrammeR,
DiagrammeRsvg,
knitr,
rmarkdown,
scda,
scda.2021
scda.2021,
purrr
VignetteBuilder:
knitr
Encoding: UTF-8
Expand Down
11 changes: 9 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export(aet03_1)
export(aet03_1_lyt)
export(aet04_1)
export(aet04_1_lyt)
export(append_to_pmap)
export(assert_colnames)
export(bol_YN)
export(cut_by_group)
Expand All @@ -28,10 +29,14 @@ export(ext01_2_lyt)
export(lbt01_1)
export(lbt01_1_lyt)
export(pivot_wider_labels)
export(pmap_row)
export(preprocess_data)
export(remove_tlg_pmap)
export(reorder_levels_params)
export(std_deco)
export(std_filter)
export(std_mutate)
export(std_filter_fun)
export(std_mutate_fun)
export(std_pmap)
export(syn_test_data)
export(var_labels_for)
import(dm)
Expand All @@ -45,7 +50,9 @@ importFrom(dplyr,filter)
importFrom(dplyr,mutate)
importFrom(dplyr,select)
importFrom(magrittr,"%>%")
importFrom(methods,is)
importFrom(rlang,sym)
importFrom(rtables,var_labels)
importFrom(stats,setNames)
importFrom(tibble,tribble)
importFrom(tidyr,pivot_wider)
20 changes: 3 additions & 17 deletions R/aet02.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@
#' library(rtables)
#'
#' db <- syn_test_data() %>%
#' dm_select_tbl(adsl, adae)
#'
#' db <- db %>%
#' (std_filter("aet02_1"))() %>%
#' (std_mutate("aet02_1"))()
#' preprocess_data("aet02_1")
#'
#' aet02_1(adam_db = db) %>% head(15)
#'
Expand Down Expand Up @@ -96,7 +92,6 @@ aet02_1 <- function(adam_db,
#' @param lbl_AEBODSYS (`string`) text label for AEBODSYS.
#' @param lbl_AEDECOD (`string`) text label for AEDECOD.
#'
#' @return
#' @export
#'
#' @examples
Expand Down Expand Up @@ -180,11 +175,8 @@ aet02_1_lyt <- function(armvar = .study$armvar,
#' library(rtables)
#'
#' db <- syn_test_data() %>%
#' dm_select_tbl(adsl, adae)
#' preprocess_data("aet02_2")
#'
#' db <- db %>%
#' (std_filter("aet02_2"))() %>%
#' (std_mutate("aet02_2"))()
#'
#' aet02_2(db) %>% head(15)
#'
Expand Down Expand Up @@ -255,7 +247,6 @@ aet02_2 <- function(adam_db,
#' @param lbl_AEHLT (`string`) text label for AEHLT.
#' @param lbl_AEDECOD (`string`) text label for AEDECOD.
#'
#' @return
#' @export
#'
#' @examples
Expand Down Expand Up @@ -356,11 +347,7 @@ aet02_2_lyt <- function(armvar = .study$armvar,
#' library(dm)
#'
#' db <- syn_test_data() %>%
#' dm_select_tbl(adsl, adae)
#'
#' db <- db %>%
#' (std_filter("aet02_3"))() %>%
#' (std_mutate("aet02_3"))()
#' preprocess_data("aet02_3")
#'
#' aet02_3(adam_db = db) %>% head()
#'
Expand Down Expand Up @@ -406,7 +393,6 @@ aet02_3 <- function(adam_db,
#'
#' @param lbl_AEDECOD (`string`) text label for AEDECOD.
#'
#' @return
#' @export
#'
#' @examples
Expand Down
19 changes: 8 additions & 11 deletions R/aet03.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@
#' library(rtables)
#'
#' db <- syn_test_data() %>%
#' dm_select_tbl(adsl, adae)
#'
#' db <- db %>%
#' (std_filter("aet03_1"))() %>%
#' (std_mutate("aet03_1"))()
#' preprocess_data("aet03_1")
#'
#' aet03_1(db)
#' aet03_1(db, lbl_overall = "All Patients")
Expand Down Expand Up @@ -94,15 +90,16 @@ aet03_1 <- function(adam_db,
#' @param lbl_AEDECOD (`string`) text label for AEDECOD.
#' @param severity_grade (`vector of strings`) describing the severity levels present in the data set.
#'
#' @return
#' @export
#'
#' @examples
#' aet03_1_lyt(armvar = "ACTARM",
#' lbl_AEBODSYS = "Body System or Organ Class",
#' lbl_AEDECOD = "Dictionary-Derived Term",
#' lbl_overall = NULL,
#' deco = std_deco("AET03"))
#' aet03_1_lyt(
#' armvar = "ACTARM",
#' 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 = "",
Expand Down
7 changes: 1 addition & 6 deletions R/aet04.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@
#' library(rtables)
#'
#' db <- syn_test_data() %>%
#' dm_select_tbl(adsl, adae)
#'
#' db <- db %>%
#' (std_filter("aet03_1"))() %>%
#' (std_mutate("aet03_1"))()
#' preprocess_data("aet03_1")
#'
#' aet04_1(db)
#' aet04_1(db, prune_0 = FALSE)
Expand Down Expand Up @@ -103,7 +99,6 @@ aet04_1 <- function(adam_db,
#' @param lbl_AEDECOD (`string`) text label for AEDECOD.
#' @param group_grades (`list`) putting in correspondence severity levels and labels.
#'
#' @return
#' @export
#'
#' @examples
Expand Down
9 changes: 1 addition & 8 deletions R/dmt01.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,9 @@
#' @examples
#'
#' library(dm)
#' library(dplyr)
#'
#' db <- syn_test_data() %>%
#' dm_select_tbl(adsl)
#'
#' db <- db %>%
#' (std_filter("dmt01_1"))() %>%
#' (std_mutate("dmt01_1"))()
#'
#' preprocess_data("dmt01_1")
#'
#' dmt01_1(db, summaryvars = c("AGE", "RACE", "SEX", "BWGHTSI"))
#' dmt01_1(db, summaryvars = c("AGE", "RACE", "SEX"), lbl_overall = NULL)
Expand Down Expand Up @@ -82,7 +76,6 @@ dmt01_1 <- function(adam_db,
#' @param summaryvars (`vector of strings`) variables summarized in demographic table.
#' @param summaryvars_lbls (`vector of strings`) labels corresponding to the analyzed variables.
#'
#' @return
#' @export
#'
#' @examples
Expand Down
27 changes: 4 additions & 23 deletions R/dst01.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,24 +45,18 @@ check_dst01_1_args <- function(reason, status, status_treatment) {
#' @examples
#'
#' library(dm)
#' library(dplyr)
#'
#' db <- syn_test_data() %>%
#' dm_select_tbl(adsl)
#'
#' db <- db %>%
#' (std_filter("dst01_1"))() %>%
#' (std_mutate("dst01_1"))()
#' preprocess_data("dst01_1")
#'
#' dst01_1(db)
#'
#'
dst01_1 <- function(adam_db,
armvar = .study$armvar,
status_var = "EOSSTT",
disc_reason_var = .study$disc_reason_var,
lbl_overall = .study$lbl_overall,
prune_0 = TRUE,
lbl_overall = .study$lbl_overall,
deco = std_deco("DST01"),
.study = list(
armvar = "ARM",
Expand Down Expand Up @@ -134,7 +128,6 @@ dst01_1 <- function(adam_db,
#' @details Since the two parts of the tables are pruned differently, the layout function returns a list of layouts,
#' which allows the tables to be constructed and pruned separately before binding.
#'
#' @return
#' @export
#'
#' @examples
Expand Down Expand Up @@ -223,14 +216,9 @@ dst01_1_lyt <- function(armvar = .study$armvar,
#'
#' @examples
#' library(dm)
#' library(dplyr)
#'
#' db <- syn_test_data() %>%
#' dm_select_tbl(adsl)
#'
#' db <- db %>%
#' (std_filter("dst01_2"))() %>%
#' (std_mutate("dst01_2"))()
#' preprocess_data("dst01_2")
#'
#' dst01_2(db)
#' dst01_2(db, lbl_overall = NULL)
Expand Down Expand Up @@ -310,7 +298,6 @@ dst01_2 <- function(adam_db,
#' @details Since the two parts of the tables are pruned differently, the layout function returns a list of layouts,
#' which allows the tables to be constructed and pruned separately before binding.
#'
#' @return
#' @export
#'
#' @examples
Expand Down Expand Up @@ -403,14 +390,9 @@ dst01_2_lyt <- function(armvar = .study$armvar,
#'
#' @examples
#' library(dm)
#' library(dplyr)
#'
#' db <- syn_test_data() %>%
#' dm_select_tbl(adsl)
#'
#' db <- db %>%
#' (std_filter("dst01_3"))() %>%
#' (std_mutate("dst01_3"))()
#' preprocess_data("dst01_3")
#'
#' dst01_3(db)
#' dst01_3(db, lbl_overall = NULL)
Expand Down Expand Up @@ -516,7 +498,6 @@ dst01_3 <- function(adam_db,
#' @param ongoing_lbl (`string`) associated with ongoing treatment and found in the columns given by `status_treatment`.
#' By Default `ONGOING.
#'
#' @return
#' @export
#'
#' @examples
Expand Down
15 changes: 2 additions & 13 deletions R/ext01.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,9 @@
#' @examples
#'
#' library(dm)
#' library(dplyr)
#'
#' db <- syn_test_data() %>%
#' dm_select_tbl(adsl, adex)
#'
#' db <- db %>%
#' (std_filter("ext01_1"))() %>%
#' (std_mutate("ext01_1"))()
#' preprocess_data("ext01_1")
#'
#' ext01_1(db)
#'
Expand Down Expand Up @@ -70,7 +65,6 @@ ext01_1 <- function(adam_db,
#' @param summaryvars `(string)` the name of the variable to be analyzed. By default `"AVAL"`.
#' @param summaryvars_lbls `(string)` the label associated with the analyzed variable.
#'
#' @return
#' @export
#'
ext01_1_lyt <- function(armvar = .study$armvar,
Expand Down Expand Up @@ -121,11 +115,7 @@ ext01_1_lyt <- function(armvar = .study$armvar,
#' library(dplyr)
#'
#' db <- syn_test_data() %>%
#' dm_select_tbl(adsl, adex)
#'
#' db <- db %>%
#' (std_filter("ext01_2"))() %>%
#' (std_mutate("ext01_2"))()
#' preprocess_data("ext01_2")
#'
#' ext01_2(db)
#'
Expand Down Expand Up @@ -170,7 +160,6 @@ ext01_2 <- function(adam_db,
#' @param summaryvars (`string`) the name of the variable to be analyzed. By default `"AVAL"`.
#' @param summaryvars_lbls (`string`) the label associated with the analyzed variable.
#'
#' @return
#' @export
#'
ext01_2_lyt <- function(armvar = .study$armvar,
Expand Down
36 changes: 6 additions & 30 deletions R/gen_args.R
Original file line number Diff line number Diff line change
@@ -1,45 +1,21 @@

#' General Argument Name Convention
#'
#' @param adam_db (`dm`) object containing the adam Datasets.
#' @param adam_db (`dm`) object containing the ADaM datasets
#' @param armvar (`character`) variable used for column splitting
#' @param deco (`character`) decoration with `title`, `subtitles` and `main_footer` content
#' @param lbl_overall (`character`) label used for overall column, if set to `NULL` the overall column is omitted
#' @param prune_0 (`logical`) remove 0 count rows
#' @param .study (`list`) with default values for the arguments of the function
#' @param ad_bl (`data.frame`) subject baseline Dataset with one row per patient
#' @param adsl (`data.frame`) Subject Level Analysis Dataset
#' @param adeg (`data.frame`) ECG Analysis Dataset
#' @param adae (`data.frame`) Adverse Events Analysis Dataset
#' @param adcm (`data.frame`) Concomitant Medications Analysis Dataset
#' @param admh (`data.frame`) Medical History Analysis Dataset
#' @param aag (`data.frame`) Adverse Event Grouping Defs Dataset
#' @param advs (`data.frame`) Vital Signs Analysis Dataset
#' @param adlb (`data.frame`) Laboratory Analysis Dataset
#' @param adex (`data.frame`) Exposure Analysis Dataset
#' @param adsub (`data.frame`) Subcategory Analysis Dataset
#' @param adrs (`data.frame`) Response Analysis Dataset
#' @param adtte (`data.frame`) Time to Event Analysis Dataset
#' @param adhy (`data.frame`) Hy's Law Analysis Dataset
#' @param adsaftte (`data.frame`) Safety Time to Event Analysis Dataset
#' @param addv (`data.frame`) Protocol Deviations Analysis Dataset
#' @param adcssrs (`data.frame`) C-SSRS Analysis Dataset
#' @param adqlqc (`data.frame`) EORTC QLQ-C30 V3 Analysis Dataset
#' @param acg (`data.frame`) Concomitant Med. Grouping Defs Dataset
#' @param adic (`data.frame`) Interval Censoring Analysis Dataset
#'
#' @param tlgfname (`character`) function name of tlg-function
#' @param pmap ('data frame') preprocessing map, see `std_pmap` for the required format
#' @param group (`list of lists`) for group-dependent data binning
#'
#' @param group nest list for group-dependent data binning
#'
#' @details the following arguments are better provided through the study object:
#' - lbl_overall
#' - armvar
#' @details the following arguments are better provided through the study object: `lbl_overall`, `armvar`.
#'
gen_args <- function(
adam_db, armvar, lbl_overall, prune_0, deco, .study,
ad_bl, adsl, adeg, adae, adcm, admh, aag, advs, adlb, adex, adsub, adrs, adtte,
adhy, adsaftte, addv, adcssrs, adqlqc, acg, adic, group
adam_db, armvar, lbl_overall, prune_0, deco, .study, group,
tlgfname, pmap
) {
NULL
}
Loading

0 comments on commit 7b4ef11

Please sign in to comment.