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

Clean up documentation for tm_g_pp_therapy #1025

Merged
merged 5 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
16 changes: 16 additions & 0 deletions R/argument_convention.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#' @param add_total (`logical`)\cr whether to include column with total number of patients.
#' @param anl_name (`character`)\cr analysis data used in teal module.
#' @param arm_var (`character`)\cr variable names that can be used as `arm_var`.
#' @param atirel (`character`)\cr name of time relation of medication variable.
#' @param aval `r lifecycle::badge("deprecated")` Please use the `aval_var` argument instead.
#' @param avalu `r lifecycle::badge("deprecated")` Please use the `avalu_var` argument instead.
#' @param avalu_var (`character`)\cr name of the analysis value unit variable.
Expand All @@ -23,6 +24,9 @@
#'
#' For more details, see the vignette: `vignette("custom-basic-table-arguments", package = "teal.widgets")`.
#' @param by_vars (`character`)\cr variable names used to split the summary by rows.
#' @param cmdecod (`character`)\cr name of standardized medication name variable.
#' @param cmindc (`character`)\cr name of indication variable.
#' @param cmstdy (`character`)\cr name of study relative day of start of medication variable.
#' @param cnsr_var (`character`)\cr name of the censoring variable.
#' @param combine_comp_arms (`logical`)\cr triggers the combination of comparison arms.
#' @param compare_arm (`logical`)\cr triggers the comparison between study arms.
Expand All @@ -37,6 +41,7 @@
#' @param drop_arm_levels (`logical`)\cr drop the unused `arm_var` levels.
#' When `TRUE`, `arm_var` levels are set to those used in the `dataname` dataset. When `FALSE`,
#' `arm_var` levels are set to those used in the `parantname` dataset.
#' @param font_size (`numeric`)\cr font size value.
#' @param ggplot2_args optional, (`ggplot2_args`)\cr object created by [teal.widgets::ggplot2_args()] with settings
#' for the module plot. The argument is merged with option `teal.ggplot2_args` and with default module arguments
#' (hard coded in the module body).
Expand All @@ -50,6 +55,7 @@
#' @param interact_y (`character`)\cr a selected item from the interact_var column which will be used to select the
#' specific `ANCOVA` results. If the interaction is not needed, the default option is `FALSE`.
#' @param llt (`character`)\cr name of the variable with low level term for events.
#' @param patient_id (`character`)\cr patient ID.
#' @param na_level (`string`)\cr used to replace all `NA` or empty values
#' in character or factor variables in the data. Defaults to `"<Missing>"`. To set a
#' default `na_level` to apply in all modules, run `set_default_na_str("new_default")`.
Expand Down Expand Up @@ -110,13 +116,21 @@ NULL
#' It defines the grouping variable(s) in the results table.
#' If there are two elements selected for `arm_var`,
#' second variable will be nested under the first variable.
#' @param atirel ([teal.transform::choices_selected()] or [teal.transform::data_extract_spec()])\cr object with all
edelarua marked this conversation as resolved.
Show resolved Hide resolved
#' available choices and preselected option for the `ATIREL` variable from `dataname`.
#' @param aval_var (`choices_selected` or `data_extract_spec`)\cr object with all available choices and preselected
#' option for the analysis variable.
#' @param avisit (`choices_selected` or `data_extract_spec`)\cr value of analysis visit `AVISIT` of interest.
#' @param baseline_var ([teal.transform::choices_selected()] or [teal.transform::data_extract_spec()])\cr object with
#' all available choices and preselected option for variable values that can be used as `baseline_var`.
#' @param by_vars (`choices_selected` or `data_extract_spec`)\cr object with all available choices and preselected
#' option for variable names used to split the summary by rows.
#' @param cmdecod ([teal.transform::choices_selected()] or [teal.transform::data_extract_spec()])\cr object with all
#' available choices and preselected option for the `CMDECOD` variable from `dataname`.
#' @param cmindc ([teal.transform::choices_selected()] or [teal.transform::data_extract_spec()])\cr object with all
#' available choices and preselected option for the `CMINDC` variable from `dataname`.
#' @param cmstdy ([teal.transform::choices_selected()] or [teal.transform::data_extract_spec()])\cr object with all
#' available choices and preselected option for the `CMSTDY` variable from `dataname`.
#' @param cnsr_var (`choices_selected` or `data_extract_spec`)\cr object with all available choices and preselected
#' option for the censoring variable.
#' @param conf_level (`choices_selected`)\cr object with all available choices and preselected option for the
Expand All @@ -131,6 +145,7 @@ NULL
#' values and `levels` of default level choices.
#' @param fixed_symbol_size (`logical`)\cr When (`TRUE`), the same symbol size is used for plotting each estimate.
#' Otherwise, the symbol size will be proportional to the sample size in each each subgroup.
#' @param font_size (`numeric`)\cr numeric vector of length 3 of current, minimum and maximum font size values.
m7pr marked this conversation as resolved.
Show resolved Hide resolved
#' @param hlt (`choices_selected` or `data_extract_spec`)\cr name of the variable with high level term for events.
#' @param id_var (`choices_selected` or `data_extract_spec`)\cr object specifying the variable name for subject id.
#' @param interact_var (`character`)\cr name of the variable that should have interactions
Expand All @@ -142,6 +157,7 @@ NULL
#' @param llt (`choices_selected` or `data_extract_spec`)\cr name of the variable with low level term for events.
#' @param paramcd (`choices_selected` or `data_extract_spec`)\cr variable value designating the studied parameter.
#' @param parentname (`character`)\cr parent analysis data used in teal module, usually this refers to `ADSL`.
#' @param patient_col (`character`)\cr name of patient ID variable.
#' @param plot_height optional, (`numeric`)\cr a vector of length three with `c(value, min, max)`. Specifies the
#' height of the main plot and renders a slider on the plot to interactively adjust the plot height.
#' @param plot_width optional, (`numeric`)\cr a vector of length three with `c(value, min, max)`. Specifies the width
Expand Down
61 changes: 26 additions & 35 deletions R/tm_g_pp_therapy.R
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
#' Template: Therapy
#' Template: Patient Profile Therapy Table and Plot
#'
#' Creates a therapy template call.
#' Creates a valid expression to generate a patient profile therapy table and [ggplot2::ggplot()] plot using ADaM
#' datasets.
#'
#' @inheritParams template_arguments
#' @param atirel (`character`)\cr name of time relation of medication variable.
#' @param cmdecod (`character`)\cr name of standardized medication name variable.
#' @param cmindc (`character`)\cr name of indication variable.
#' @param cmdose (`character`)\cr name of dose per administration variable.
#' @param cmtrt (`character`)\cr name of reported name of drug, med, or therapy variable.
#' @param cmdosu (`character`)\cr name of dose units variable.
#' @param cmroute (`character`)\cr name of route of administration variable.
#' @param cmdosfrq (`character`)\cr name of dosing frequency per interval variable.
#' @param cmstdy (`character`)\cr name of study day of start of medication variable.
#' @param cmendy (`character`)\cr name of study day of end of medication variable.
#' @param patient_id (`character`)\cr patient ID.
#' @param font_size (`numeric`)\cr numeric vector of length 3 for current, min and max font size values.
#' @keywords internal
#'
#' @inherit template_arguments return
#'
#' @seealso [tm_g_pp_therapy()]
#'
#' @keywords internal
template_therapy <- function(dataname = "ANL",
atirel = "ATIREL",
cmdecod = "CMDECOD",
Expand Down Expand Up @@ -230,36 +229,26 @@ template_therapy <- function(dataname = "ANL",
y
}

#' Teal Module: Patient Profile Therapy Teal Module
#' teal Module: Patient Profile Therapy Table and Plot
#'
#' This teal module produces a patient profile therapy plot using `ADaM` datasets.
#' This module produces a patient profile therapy table and [ggplot2::ggplot()] type plot using ADaM datasets.
#'
#' @inheritParams module_arguments
#' @inheritParams template_therapy
#' @param patient_col (`character`)\cr patient ID column to be used.
#' @param atirel ([teal.transform::choices_selected()] or [teal.transform::data_extract_spec()])\cr
#' `ATIREL` column of the `ADCM` dataset.
#' @param cmdecod ([teal.transform::choices_selected()] or [teal.transform::data_extract_spec()])\cr
#' `CMDECOD` column of the `ADCM` dataset.
#' @param cmdose ([teal.transform::choices_selected()] or [teal.transform::data_extract_spec()])\cr
#' `CMDOSE` column of the `ADCM` dataset.
#' @param cmtrt ([teal.transform::choices_selected()] or [teal.transform::data_extract_spec()])\cr
#' `CMTRT` column of the `ADCM` dataset.
#' @param cmdosu ([teal.transform::choices_selected()] or [teal.transform::data_extract_spec()])\cr
#' `CMDOSU` column of the `ADCM` dataset.
#' @param cmroute ([teal.transform::choices_selected()] or [teal.transform::data_extract_spec()])\cr
#' `CMROUTE` column of the `ADCM` dataset.
#' @param cmdosfrq ([teal.transform::choices_selected()] or [teal.transform::data_extract_spec()])\cr
#' `CMDOSFRQ` column of the `ADCM` dataset.
#' @param cmstdy ([teal.transform::choices_selected()] or [teal.transform::data_extract_spec()])\cr
#' `CMSTDY` column of the `ADCM` dataset.
#' @param cmendy ([teal.transform::choices_selected()] or [teal.transform::data_extract_spec()])\cr
#' `CMENDY` column of the `ADCM` dataset.
#' @param cmindc ([teal.transform::choices_selected()] or [teal.transform::data_extract_spec()])\cr
#' `CMINDC` column of the `ADCM` dataset.
#' @param font_size (`numeric`)\cr numeric vector of length 3 for current, min and max font size values.
#' @param cmdose ([teal.transform::choices_selected()] or [teal.transform::data_extract_spec()])\cr object with all
#' available choices and preselected option for the `CMDOSE` variable from `dataname`.
#' @param cmtrt ([teal.transform::choices_selected()] or [teal.transform::data_extract_spec()])\cr object with all
#' available choices and preselected option for the `CMTRT` variable from `dataname`.
#' @param cmdosu ([teal.transform::choices_selected()] or [teal.transform::data_extract_spec()])\cr object with all
#' available choices and preselected option for the `CMDOSU` variable from `dataname`.
#' @param cmroute ([teal.transform::choices_selected()] or [teal.transform::data_extract_spec()])\cr object with all
#' available choices and preselected option for the `CMROUTE` variable from `dataname`.
#' @param cmdosfrq ([teal.transform::choices_selected()] or [teal.transform::data_extract_spec()])\cr object with all
#' available choices and preselected option for the `CMDOSFRQ` variable from `dataname`.
#' @param cmendy ([teal.transform::choices_selected()] or [teal.transform::data_extract_spec()])\cr object with all
#' available choices and preselected option for the `CMENDY` variable from `dataname`.
#'
#' @export
#' @inherit module_arguments return
#'
#' @examples
#' library(nestcolor)
Expand Down Expand Up @@ -339,6 +328,7 @@ template_therapy <- function(dataname = "ANL",
#' shinyApp(app$ui, app$server)
#' }
#'
#' @export
tm_g_pp_therapy <- function(label,
dataname = "ADCM",
parentname = "ADSL",
Expand Down Expand Up @@ -412,6 +402,7 @@ tm_g_pp_therapy <- function(label,
)
}

#' @keywords internal
ui_g_therapy <- function(id, ...) {
ui_args <- list(...)
is_single_dataset_value <- teal.transform::is_single_dataset(
Expand Down Expand Up @@ -531,7 +522,7 @@ ui_g_therapy <- function(id, ...) {
)
}


#' @keywords internal
srv_g_therapy <- function(id,
data,
reporter,
Expand Down
16 changes: 16 additions & 0 deletions man/module_arguments.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions man/template_arguments.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/template_g_km.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 11 additions & 4 deletions man/template_therapy.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading