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

teal.data::datanames() is deprecated in favor of dot-prefix and names() #1239

Merged
merged 16 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from 9 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
8 changes: 4 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ BugReports:
https://github.com/insightsengineering/teal.modules.clinical/issues
Depends:
R (>= 4.0),
teal (>= 0.15.2.9052),
teal.transform (>= 0.5.0),
teal (>= 0.15.2.9079),
teal.transform (>= 0.5.0.9015),
tern (>= 0.9.6)
Imports:
broom (>= 0.7.10),
Expand All @@ -55,8 +55,8 @@ Imports:
shinyvalidate,
shinyWidgets (>= 0.5.1),
stats,
teal.code (>= 0.5.0),
teal.data (>= 0.4.0),
teal.code (>= 0.5.0.9012),
teal.data (>= 0.6.0.9015),
teal.logger (>= 0.2.0.9004),
teal.reporter (>= 0.2.1),
teal.widgets (>= 0.4.0),
Expand Down
3 changes: 1 addition & 2 deletions R/tm_a_gee.R
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,7 @@ template_a_gee <- function(output_table,
#' ) %>%
#' droplevels()
#' })
#' datanames(data) <- c("ADSL", "ADQS")
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' app <- init(
#' data = data,
Expand Down
5 changes: 2 additions & 3 deletions R/tm_a_mmrm.R
Original file line number Diff line number Diff line change
Expand Up @@ -491,8 +491,7 @@ template_mmrm_plots <- function(fit_name,
#' as.factor() #' making consecutive numeric factor
#' )
#' })
#' datanames(data) <- c("ADSL", "ADQS")
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' app <- init(
#' data = data,
Expand Down Expand Up @@ -1402,7 +1401,7 @@ srv_mmrm <- function(id,

all_q <- reactive({
if (!is.null(plot_q()) && !is.null(table_q())) {
teal.code::join(plot_q(), table_q())
c(plot_q(), table_q())
} else if (!is.null(plot_q())) {
plot_q()
} else {
Expand Down
7 changes: 4 additions & 3 deletions R/tm_g_barchart_simple.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
#' ADAE <- tmc_ex_adae %>%
#' filter(!((AETOXGR == 1) & (AESEV == "MILD") & (ARM == "A: Drug X")))
#' })
#' datanames(data) <- c("ADSL", "ADAE")
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' ADSL <- data[["ADSL"]]
#' ADAE <- data[["ADAE"]]
Expand Down Expand Up @@ -421,7 +420,9 @@ srv_g_barchart_simple <- function(id,
count_exprs <- c(count_exprs, count_exprs2, count_str_to_col_exprs)
}

data_list <- sapply(teal.data::datanames(data()), function(x) reactive(data()[[x]]),
data_list <- sapply(
names(data()),
function(x) reactive(data()[[x]]),
simplify = FALSE
)

Expand Down
3 changes: 1 addition & 2 deletions R/tm_g_ci.R
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,7 @@ template_g_ci <- function(dataname,
#' ADSL <- tmc_ex_adsl
#' ADLB <- tmc_ex_adlb
#' })
#' datanames(data) <- c("ADSL", "ADLB")
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' ADSL <- data[["ADSL"]]
#' ADLB <- data[["ADLB"]]
Expand Down
3 changes: 1 addition & 2 deletions R/tm_g_forest_rsp.R
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,7 @@ template_forest_rsp <- function(dataname = "ANL",
#' with_label("Character Result/Finding")) %>%
#' filter(PARAMCD != "OVRINV" | AVISIT == "FOLLOW UP")
#' })
#' datanames(data) <- c("ADSL", "ADRS")
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' ADSL <- data[["ADSL"]]
#' ADRS <- data[["ADRS"]]
Expand Down
3 changes: 1 addition & 2 deletions R/tm_g_forest_tte.R
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,7 @@ template_forest_tte <- function(dataname = "ANL",
#' ADTTE <- tmc_ex_adtte
#' ADSL$RACE <- droplevels(ADSL$RACE) %>% with_label("Race")
#' })
#' datanames(data) <- c("ADSL", "ADTTE")
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' ADSL <- data[["ADSL"]]
#' ADTTE <- data[["ADTTE"]]
Expand Down
3 changes: 1 addition & 2 deletions R/tm_g_ipp.R
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,7 @@ template_g_ipp <- function(dataname = "ANL",
#' df_explicit_na() %>%
#' filter(AVISIT != "SCREENING")
#' })
#' datanames(data) <- c("ADSL", "ADLB")
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' ADSL <- data[["ADSL"]]
#' ADLB <- data[["ADLB"]]
Expand Down
3 changes: 1 addition & 2 deletions R/tm_g_km.R
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,7 @@ template_g_km <- function(dataname = "ANL",
#' ADSL <- tmc_ex_adsl
#' ADTTE <- tmc_ex_adtte
#' })
#' datanames(data) <- c("ADSL", "ADTTE")
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' ADSL <- data[["ADSL"]]
#' ADTTE <- data[["ADTTE"]]
Expand Down
3 changes: 1 addition & 2 deletions R/tm_g_lineplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,7 @@ template_g_lineplot <- function(dataname = "ANL",
#' ADLB <- tmc_ex_adlb %>%
#' mutate(AVISIT == fct_reorder(AVISIT, AVISITN, min))
#' })
#' datanames(data) <- c("ADSL", "ADLB")
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' ADSL <- data[["ADSL"]]
#' ADLB <- data[["ADLB"]]
Expand Down
3 changes: 1 addition & 2 deletions R/tm_g_pp_adverse_events.R
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,7 @@ template_adverse_events <- function(dataname = "ANL",
#' ADSL <- tmc_ex_adsl %>%
#' filter(USUBJID %in% ADAE$USUBJID)
#' })
#' datanames(data) <- c("ADSL", "ADAE")
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' ADSL <- data[["ADSL"]]
#' ADAE <- data[["ADAE"]]
Expand Down
1 change: 0 additions & 1 deletion R/tm_g_pp_patient_timeline.R
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,6 @@ template_patient_timeline <- function(dataname = "ANL",
#' )
#' })
#'
#' datanames(data) <- c("ADSL", "ADAE", "ADCM")
#' join_keys(data) <- default_cdisc_join_keys[c("ADSL", "ADAE", "ADCM")]
#' adcm_keys <- c("STUDYID", "USUBJID", "ASTDTM", "CMSEQ", "ATC1", "ATC2", "ATC3", "ATC4")
#' join_keys(data)["ADCM", "ADCM"] <- adcm_keys
Expand Down
2 changes: 0 additions & 2 deletions R/tm_g_pp_therapy.R
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,6 @@ template_therapy <- function(dataname = "ANL",
#' ADCM$CMAENDTM <- ADCM$AENDTM
#' })
#'
#' datanames(data) <- c("ADSL", "ADCM")
#'
#' join_keys(data) <- default_cdisc_join_keys[c("ADSL", "ADCM")]
#' adcm_keys <- c("STUDYID", "USUBJID", "ASTDTM", "CMSEQ", "ATC1", "ATC2", "ATC3", "ATC4")
#' join_keys(data)["ADCM", "ADCM"] <- adcm_keys
Expand Down
3 changes: 1 addition & 2 deletions R/tm_g_pp_vitals.R
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,7 @@ template_vitals <- function(dataname = "ANL",
#' ADSL <- tmc_ex_adsl
#' ADVS <- tmc_ex_advs
#' })
#' datanames(data) <- c("ADSL", "ADVS")
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' ADSL <- data[["ADSL"]]
#' ADVS <- data[["ADVS"]]
Expand Down
3 changes: 1 addition & 2 deletions R/tm_t_abnormality.R
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,7 @@ template_abnormality <- function(parentname,
#' ) %>% with_label("On Treatment Record Flag")
#' )
#' })
#' datanames(data) <- c("ADSL", "ADLB")
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' ADSL <- data[["ADSL"]]
#' ADLB <- data[["ADLB"]]
Expand Down
3 changes: 1 addition & 2 deletions R/tm_t_abnormality_by_worst_grade.R
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,7 @@ template_abnormality_by_worst_grade <- function(parentname, # nolint: object_len
#' ADLB <- tmc_ex_adlb %>%
#' filter(!AVISIT %in% c("SCREENING", "BASELINE"))
#' })
#' datanames(data) <- c("ADSL", "ADLB")
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' ADSL <- data[["ADSL"]]
#' ADLB <- data[["ADLB"]]
Expand Down
3 changes: 1 addition & 2 deletions R/tm_t_ancova.R
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,7 @@ template_ancova <- function(dataname = "ANL",
#' ADSL <- tmc_ex_adsl
#' ADQS <- tmc_ex_adqs
#' })
#' datanames(data) <- c("ADSL", "ADQS")
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' ADSL <- data[["ADSL"]]
#' ADQS <- data[["ADQS"]]
Expand Down
3 changes: 1 addition & 2 deletions R/tm_t_binary_outcome.R
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,7 @@ template_binary_outcome <- function(dataname,
#' ) %>%
#' filter(PARAMCD != "OVRINV" | AVISIT == "FOLLOW UP")
#' })
#' datanames(data) <- c("ADSL", "ADRS")
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' ADSL <- data[["ADSL"]]
#' ADRS <- data[["ADRS"]]
Expand Down
6 changes: 2 additions & 4 deletions R/tm_t_coxreg.R
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,7 @@ template_coxreg_m <- function(dataname,
#' ADSL <- tmc_ex_adsl
#' ADTTE <- tmc_ex_adtte
#' })
#' datanames(data) <- c("ADSL", "ADTTE")
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' ADSL <- data[["ADSL"]]
#' ADTTE <- data[["ADTTE"]]
Expand Down Expand Up @@ -461,8 +460,7 @@ template_coxreg_m <- function(dataname,
#' )
#' })
#'
#' datanames(data) <- c("ADSL", "ADTTE")
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' ADSL <- data[["ADSL"]]
#' ADTTE <- data[["ADTTE"]]
Expand Down
3 changes: 1 addition & 2 deletions R/tm_t_events.R
Original file line number Diff line number Diff line change
Expand Up @@ -472,8 +472,7 @@ template_events <- function(dataname,
#' ADSL <- tmc_ex_adsl
#' ADAE <- tmc_ex_adae
#' })
#' datanames(data) <- c("ADSL", "ADAE")
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' ADSL <- data[["ADSL"]]
#' ADAE <- data[["ADAE"]]
Expand Down
7 changes: 3 additions & 4 deletions R/tm_t_events_by_grade.R
Original file line number Diff line number Diff line change
Expand Up @@ -803,13 +803,12 @@ template_events_col_by_grade <- function(dataname,
#' data <- teal_data()
#' data <- within(data, {
#' ADSL <- tmc_ex_adsl
#' lbls_adae <- col_labels(tmc_ex_adae)
#' .lbls_adae <- col_labels(tmc_ex_adae)
#' ADAE <- tmc_ex_adae %>%
#' mutate_if(is.character, as.factor) #' be certain of having factors
#' col_labels(ADAE) <- lbls_adae
#' col_labels(ADAE) <- .lbls_adae
#' })
#' datanames(data) <- c("ADSL", "ADAE")
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' ADSL <- data[["ADSL"]]
#' ADAE <- data[["ADAE"]]
Expand Down
3 changes: 1 addition & 2 deletions R/tm_t_events_patyear.R
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,7 @@ template_events_patyear <- function(dataname,
#' mutate(is_event = CNSR == 0) %>%
#' mutate(n_events = as.integer(is_event))
#' })
#' datanames(data) <- c("ADSL", "ADAETTE")
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' ADSL <- data[["ADSL"]]
#' ADAETTE <- data[["ADAETTE"]]
Expand Down
19 changes: 9 additions & 10 deletions R/tm_t_events_summary.R
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ template_events_summary <- function(anl_name,
#' )
#' ADAE <- tmc_ex_adae
#'
#' add_event_flags <- function(dat) {
#' .add_event_flags <- function(dat) {
#' dat <- dat %>%
#' mutate(
#' TMPFL_SER = AESER == "Y",
Expand All @@ -564,13 +564,12 @@ template_events_summary <- function(anl_name,
#' }
#'
#' #' Generating user-defined event flags.
#' ADAE <- ADAE %>% add_event_flags()
#' ADAE <- ADAE %>% .add_event_flags()
#'
#' ae_anl_vars <- names(ADAE)[startsWith(names(ADAE), "TMPFL_")]
#' aesi_vars <- names(ADAE)[startsWith(names(ADAE), "TMP_")]
#' .ae_anl_vars <- names(ADAE)[startsWith(names(ADAE), "TMPFL_")]
#' .aesi_vars <- names(ADAE)[startsWith(names(ADAE), "TMP_")]
#' })
#' datanames(data) <- c("ADSL", "ADAE")
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' app <- init(
#' data = data,
Expand All @@ -583,14 +582,14 @@ template_events_summary <- function(anl_name,
#' selected = "ARM"
#' ),
#' flag_var_anl = choices_selected(
#' choices = variable_choices("ADAE", data[["ae_anl_vars"]]),
#' selected = data[["ae_anl_vars"]][1],
#' choices = variable_choices("ADAE", data[[".ae_anl_vars"]]),
#' selected = data[[".ae_anl_vars"]][1],
#' keep_order = TRUE,
#' fixed = FALSE
#' ),
#' flag_var_aesi = choices_selected(
#' choices = variable_choices("ADAE", data[["aesi_vars"]]),
#' selected = data[["aesi_vars"]][1],
#' choices = variable_choices("ADAE", data[[".aesi_vars"]]),
#' selected = data[[".aesi_vars"]][1],
#' keep_order = TRUE,
#' fixed = FALSE
#' ),
Expand Down
7 changes: 3 additions & 4 deletions R/tm_t_exposure.R
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ template_exposure <- function(parentname,
#' ADEX <- tmc_ex_adex
#'
#' set.seed(1, kind = "Mersenne-Twister")
#' labels <- col_labels(ADEX, fill = FALSE)
#' .labels <- col_labels(ADEX, fill = FALSE)
#' ADEX <- ADEX %>%
#' distinct(USUBJID, .keep_all = TRUE) %>%
#' mutate(
Expand All @@ -251,10 +251,9 @@ template_exposure <- function(parentname,
#' AVALU = "Days"
#' ) %>%
#' bind_rows(ADEX)
#' col_labels(ADEX) <- labels
#' col_labels(ADEX) <- .labels
#' })
#' datanames(data) <- c("ADSL", "ADEX")
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' app <- init(
#' data = data,
Expand Down
3 changes: 1 addition & 2 deletions R/tm_t_logistic.R
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,7 @@ template_logistic <- function(dataname,
#' ADRS <- tmc_ex_adrs %>%
#' filter(PARAMCD %in% c("BESRSPI", "INVET"))
#' })
#' datanames(data) <- c("ADSL", "ADRS")
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' ADSL <- data[["ADSL"]]
#' ADRS <- data[["ADRS"]]
Expand Down
3 changes: 1 addition & 2 deletions R/tm_t_mult_events.R
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,7 @@ template_mult_events <- function(dataname,
#' ADSL <- tmc_ex_adsl
#' ADCM <- tmc_ex_adcm
#' })
#' datanames(data) <- c("ADSL", "ADCM")
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#' adcm_keys <- c("STUDYID", "USUBJID", "ASTDTM", "CMSEQ", "ATC1", "ATC2", "ATC3", "ATC4")
#' join_keys(data)["ADCM", "ADCM"] <- adcm_keys
#'
Expand Down
3 changes: 1 addition & 2 deletions R/tm_t_pp_basic_info.R
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ template_basic_info <- function(dataname = "ANL",
#' data <- within(data, {
#' ADSL <- tmc_ex_adsl
#' })
#' datanames(data) <- c("ADSL")
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' ADSL <- data[["ADSL"]]
#'
Expand Down
3 changes: 1 addition & 2 deletions R/tm_t_pp_laboratory.R
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,7 @@ template_laboratory <- function(dataname = "ANL",
#' ADSL <- tmc_ex_adsl
#' ADLB <- tmc_ex_adlb
#' })
#' datanames(data) <- c("ADSL", "ADLB")
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' ADSL <- data[["ADSL"]]
#' ADLB <- data[["ADLB"]]
Expand Down
3 changes: 1 addition & 2 deletions R/tm_t_pp_medical_history.R
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ template_medical_history <- function(dataname = "ANL",
#' ADSL <- tmc_ex_adsl
#' ADMH <- tmc_ex_admh
#' })
#' datanames(data) <- c("ADSL", "ADMH")
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' ADSL <- data[["ADSL"]]
#' ADMH <- data[["ADMH"]]
Expand Down
3 changes: 1 addition & 2 deletions R/tm_t_pp_prior_medication.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ template_prior_medication <- function(dataname = "ANL",
#' ADCM$CMASTDTM <- ADCM$ASTDTM
#' ADCM$CMAENDTM <- ADCM$AENDTM
#' })
#' datanames(data) <- c("ADSL", "ADCM")
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#' adcm_keys <- c("STUDYID", "USUBJID", "ASTDTM", "CMSEQ", "ATC1", "ATC2", "ATC3", "ATC4")
#' join_keys(data)["ADCM", "ADCM"] <- adcm_keys
#'
Expand Down
Loading
Loading