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

Update use of deprecated strat argument from tern #1081

Merged
merged 9 commits into from
Feb 28, 2024
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
### Miscellaneous
* Removed `formatters` from dependencies and replaced the use of its functions relating to variable labels with functions from `teal.data`.
* Replaced instances of deprecated `na_level` argument to `tern` functions with `na_str`.
* Updated all template functions to use argument/list element name `strata` instead of `strat` in all `tern` function inputs following the deprecation of this argument/name within `tern`.

# teal.modules.clinical 0.9.0

Expand Down
2 changes: 1 addition & 1 deletion R/tm_g_forest_rsp.R
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ template_forest_rsp <- function(dataname = "ANL",
substitute(
expr = df <- extract_rsp_subgroups(
variables = list(
rsp = "is_rsp", arm = arm_var, subgroups = subgroup_var, strat = strata_var
rsp = "is_rsp", arm = arm_var, subgroups = subgroup_var, strata = strata_var
),
data = anl,
conf_level = conf_level
Expand Down
2 changes: 1 addition & 1 deletion R/tm_g_forest_tte.R
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ template_forest_tte <- function(dataname = "ANL",
is_event = "is_event",
arm = arm_var,
subgroups = subgroup_var,
strat = strata_var
strata = strata_var
),
control = control_coxph(conf_level = conf_level),
data = anl
Expand Down
2 changes: 1 addition & 1 deletion R/tm_g_km.R
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ template_g_km <- function(dataname = "ANL",

y$variables <- if (length(strata_var) != 0) {
substitute(
expr = variables <- list(tte = tte, is_event = "is_event", arm = arm, strat = strata_var),
expr = variables <- list(tte = tte, is_event = "is_event", arm = arm, strata = strata_var),
env = list(tte = aval_var, arm = arm_var, strata_var = strata_var)
)
} else {
Expand Down
2 changes: 1 addition & 1 deletion R/tm_t_tte.R
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ template_tte <- function(dataname = "ANL",
vars = aval_var,
is_event = "is_event",
var_labels = paste0("Stratified By: ", paste(strata_var, collapse = ", ")),
strat = strata_var,
strata = strata_var,
control = control_coxph(
pval_method = pval_method,
ties = ties,
Expand Down
4 changes: 2 additions & 2 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ get_var_labels <- function(datasets, dataname, vars) {
#' basic_table() %>%
#' split_cols_by(var = "ARMCD") %>%
#' test_proportion_diff(
#' vars = "rsp", method = "cmh", variables = list(strata = "strat")
#' vars = "rsp", method = "cmh", variables = list(strata = "strata")
#' ) %>%
#' build_table(df = dta)
#' })
Expand Down Expand Up @@ -155,7 +155,7 @@ pipe_expr <- function(exprs, pipe_str = "%>%") {
#' lyt,
#' substitute(
#' test_proportion_diff(
#' vars = "rsp", method = "cmh", variables = list(strata = "strat")
#' vars = "rsp", method = "cmh", variables = list(strata = "strata")
#' )
#' )
#' )
Expand Down
2 changes: 1 addition & 1 deletion man/add_expr.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/h_concat_expr.Rd

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

2 changes: 1 addition & 1 deletion tests/testthat/_snaps/tm_g_forest_rsp.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
$summary
{
df <- extract_rsp_subgroups(variables = list(rsp = "is_rsp",
arm = "ARMCD", subgroups = c("SEX", "STRATA2"), strat = NULL),
arm = "ARMCD", subgroups = c("SEX", "STRATA2"), strata = NULL),
data = adrs, conf_level = 0.95)
}

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/tm_g_forest_tte.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
{
df <- extract_survival_subgroups(variables = list(tte = "AVAL",
is_event = "is_event", arm = "ARMCD", subgroups = c("SEX",
"BMRKR2"), strat = "STRATA2"), control = control_coxph(conf_level = 0.9),
"BMRKR2"), strata = "STRATA2"), control = control_coxph(conf_level = 0.9),
data = anl)
}

Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/_snaps/utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Code
res
Output
[1] "rtables::basic_table() %>% rtables::split_cols_by(var = \"ARMCD\") %>% tern::test_proportion_diff(vars = \"rsp\", method = \"cmh\", variables = list(strata = \"strat\")) %>% rtables::build_table(df = dta)"
[1] "rtables::basic_table() %>% rtables::split_cols_by(var = \"ARMCD\") %>% tern::test_proportion_diff(vars = \"rsp\", method = \"cmh\", variables = list(strata = \"strata\")) %>% rtables::build_table(df = dta)"

# add_expr adds expressions to expression list

Expand All @@ -17,7 +17,7 @@
rtables::split_cols_by(var = arm)

[[3]]
tern::test_proportion_diff(vars = "rsp", method = "cmh", variables = list(strata = "strat"))
tern::test_proportion_diff(vars = "rsp", method = "cmh", variables = list(strata = "strata"))

[[4]]
rtables::build_table(df = dta)
Expand All @@ -29,7 +29,7 @@
res
Output
rtables::basic_table() %>% rtables::split_cols_by(var = arm) %>%
test_proportion_diff(vars = "rsp", method = "cmh", variables = list(strata = "strat")) %>%
test_proportion_diff(vars = "rsp", method = "cmh", variables = list(strata = "strata")) %>%
rtables::build_table(df = dta)

# bracket_expr concatenates expressions into a single expression
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ testthat::test_that("h_concat_expr returns a string for long expression", {
rtables::basic_table() %>%
rtables::split_cols_by(var = "ARMCD") %>%
tern::test_proportion_diff(
vars = "rsp", method = "cmh", variables = list(strata = "strat")
vars = "rsp", method = "cmh", variables = list(strata = "strata")
) %>%
rtables::build_table(df = dta)
)
Expand Down Expand Up @@ -34,7 +34,7 @@ testthat::test_that("add_expr adds expressions to expression list", {
lyt,
substitute(
tern::test_proportion_diff(
vars = "rsp", method = "cmh", variables = list(strata = "strat")
vars = "rsp", method = "cmh", variables = list(strata = "strata")
)
)
)
Expand All @@ -54,7 +54,7 @@ testthat::test_that("add_expr manages expression list which can be used by pipe_
lyt,
substitute(
test_proportion_diff(
vars = "rsp", method = "cmh", variables = list(strata = "strat")
vars = "rsp", method = "cmh", variables = list(strata = "strata")
)
)
)
Expand Down
Loading