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

Closes #2091 fixing deprecation messaging in derive_param_doseint() #2092

Merged
merged 4 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
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))
Comment on lines -296 to -303
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should not remove this part because otherwise the following does not issue a deprecation warning.

> derive_param_computed(
+   advs,
+   by_vars = exprs(USUBJID, VISIT),
+   parameters = c("SYSBP", "DIABP"),
+   analysis_var = CHR,
+   set_values_to = exprs(
+     AVAL = (AVAL.SYSBP + 2 * AVAL.DIABP) / 3,
+     PARAMCD = "MAP",
+     PARAM = "Mean Arterial Pressure (mmHg)",
+     AVALU = "mmHg"
+   )
+ )

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was a bit confused by analysis_var and analysis_value, but I think I fixed it now, hopefully!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you committed your fix?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will be up in a minute, still running check()

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)
)
}