Skip to content

Commit

Permalink
Closes #2091 fixing deprecation messaging in derive_param_doseint() (
Browse files Browse the repository at this point in the history
…#2092)

* feat: #2091 did that work?

* chore: #2091 address errors

* fixed deprecation warning

* deprecation for analysis_var

---------

Co-authored-by: Zelos Zhu <[email protected]>
Co-authored-by: StefanThoma <[email protected]>
  • Loading branch information
3 people authored Sep 11, 2023
1 parent d214973 commit 6612e23
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
19 changes: 11 additions & 8 deletions R/derive_param_computed.R
Original file line number Diff line number Diff line change
Expand Up @@ -293,14 +293,6 @@ derive_param_computed <- function(dataset = NULL,
constant_parameters = NULL,
keep_nas = FALSE) {
assert_vars(by_vars)
if (!missing(analysis_var)) {
deprecate_warn(
"0.12.0",
"derive_param_computed(analysis_var = )",
"derive_param_computed(set_values_to = )"
)
}
analysis_var <- assert_symbol(enexpr(analysis_var))
assert_vars(constant_by_vars, optional = TRUE)
assert_data_frame(dataset, required_vars = by_vars, optional = TRUE)
assert_data_frame(dataset_add, optional = TRUE)
Expand All @@ -310,6 +302,16 @@ derive_param_computed <- function(dataset = NULL,
assert_param_does_not_exist(dataset, set_values_to$PARAMCD)
}
assert_logical_scalar(keep_nas)
### BEGIN DEPRECATION
if (!missing(analysis_var)) {
deprecate_warn(
"0.12.0",
"derive_param_computed(analysis_var = )",
"derive_param_computed(set_values_to = )"
)
}
analysis_var <- assert_symbol(enexpr(analysis_var))

if (!missing(analysis_value)) {
deprecate_warn(
"0.12.0",
Expand All @@ -318,6 +320,7 @@ derive_param_computed <- function(dataset = NULL,
)
set_values_to <- exprs(!!analysis_var := !!enexpr(analysis_value), !!!set_values_to)
}
### END DEPRECATION

parameters <- assert_parameters_argument(parameters)
constant_parameters <- assert_parameters_argument(constant_parameters, optional = TRUE)
Expand Down
5 changes: 3 additions & 2 deletions R/derive_param_doseint.R
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ derive_param_doseint <- function(dataset,
aval_tadm <- sym(paste0("AVAL.", tadm_code))
aval_tpdm <- sym(paste0("AVAL.", tpadm_code))

analysis_value <- exprs(AVAL = !!aval_tadm / !!aval_tpdm * 100)

# handle 0 doses planned if needed
if (zero_doses == "100") {
update_aval <- exprs(
Expand All @@ -151,7 +153,6 @@ derive_param_doseint <- function(dataset,
filter = !!filter,
parameters = c(tadm_code, tpadm_code),
by_vars = by_vars,
analysis_value = (!!aval_tadm / !!aval_tpdm * 100),
set_values_to = expr_c(set_values_to, update_aval)
set_values_to = expr_c(set_values_to, analysis_value, update_aval)
)
}

0 comments on commit 6612e23

Please sign in to comment.