Skip to content

Commit

Permalink
Closes #1968 compute multiple variables in derive_param_computed() (#…
Browse files Browse the repository at this point in the history
…2036)

* #1968 compute_multiple_vars: update arguments of derive_param_computed()

* #1968 compute_multiple_vars: update documentation

* #1968 compute_multiple_vars: update documentation

* #1968 compute_multiple_vars: style files

* #1968 compute_multiple_vars: fix R-CMD checks

* #1968 compute_multiple_vars: update error message of get_hori_data()

* #1968 compute_multiple_vars: improve documentation

* #1968 compute_multiple_vars: use deprecation badge

* #1968 compute_multiple_vars: use deprecation badge

* Update NEWS.md

Co-authored-by: Zelos Zhu <[email protected]>

* #1968 compute_multiple_vars: use @Keywords internal

* #1968 compute_multiple_vars: fix typo in NEWS.md

---------

Co-authored-by: Daniel Sjoberg <[email protected]>
Co-authored-by: Ben Straub <[email protected]>
Co-authored-by: Zelos Zhu <[email protected]>
  • Loading branch information
4 people authored Aug 21, 2023
1 parent 47a4943 commit 1d44b96
Show file tree
Hide file tree
Showing 31 changed files with 447 additions and 214 deletions.
10 changes: 10 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@

- The function `derive_var_extreme_flag()` has a new function argument, `flag_all` that additionally flags all records if the first or last record is not unique. (#1979)

- The function `derive_param_computed()` was enhanced: (#1968)

- The `analysis_value` and `analysis_var` arguments were deprecated in favor of
`set_values_to`. This enables users to compute more than one variable.
- The `keep_nas` argument was added. If it is set to `TRUE`, observations are
created even if values contributing to the computed values are `NA`.

- The function `derive_vars_dy()` is updated to avoid potential error when the input `dataset` with columns ending with `temp`. (#2012)


Expand Down Expand Up @@ -40,6 +47,9 @@
- The `filter` argument in `derive_extreme_records()` was deprecated in favor of
the `filter_add` using the next phase of the deprecation process. (#1950)

- The `analysis_value` and `analysis_var` arguments in `derive_param_computed()`
were deprecated in favor of `set_values_to` (#1968).

- The `na_val` argument in `derive_var_shift()` has been deprecated in favor of
`missing_value` using the first phase of the deprecation process. (#2014)

Expand Down
24 changes: 16 additions & 8 deletions R/derive_adeg_params.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
#'
#' Permitted Values: A variable of the input dataset or a function call
#'
#' @inheritParams derive_param_map
#'
#' @inheritParams derive_param_computed
#'
#' @seealso [compute_qtc()]
Expand Down Expand Up @@ -152,12 +154,14 @@ derive_param_qtc <- function(dataset,
filter = !!filter,
parameters = c(qt_code, rr_code),
by_vars = by_vars,
analysis_value = compute_qtc(
qt = !!sym(paste0("AVAL.", qt_code)),
rr = !!sym(paste0("AVAL.", rr_code)),
method = !!method
),
set_values_to = set_values_to
set_values_to = exprs(
AVAL = compute_qtc(
qt = !!sym(paste0("AVAL.", qt_code)),
rr = !!sym(paste0("AVAL.", rr_code)),
method = !!method
),
!!!set_values_to
)
)
}

Expand Down Expand Up @@ -269,6 +273,8 @@ compute_qtc <- function(qt, rr, method) {
#'
#' Permitted Values: character value
#'
#' @inheritParams derive_param_map
#'
#' @inheritParams derive_param_computed
#'
#' @inheritParams derive_param_qtc
Expand Down Expand Up @@ -339,8 +345,10 @@ derive_param_rr <- function(dataset,
filter = !!filter,
parameters = c(hr_code),
by_vars = by_vars,
analysis_value = compute_rr(!!sym(paste0("AVAL.", hr_code))),
set_values_to = set_values_to
set_values_to = exprs(
AVAL = compute_rr(!!sym(paste0("AVAL.", hr_code))),
!!!set_values_to
)
)
}

Expand Down
30 changes: 24 additions & 6 deletions R/derive_advs_params.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@
#'
#' *Permitted Values:* character value
#'
#' @param set_values_to Variables to be set
#'
#' The specified variables are set to the specified values for the new
#' observations. For example `exprs(PARAMCD = "MAP")` defines the parameter code
#' for the new parameter.
#'
#' *Permitted Values*: List of variable-value pairs
#'
#' @inheritParams derive_param_computed
#'
#' @inheritParams derive_param_qtc
Expand Down Expand Up @@ -148,8 +156,10 @@ derive_param_map <- function(dataset,
filter = !!filter,
parameters = c(sysbp_code, diabp_code, hr_code),
by_vars = by_vars,
analysis_value = !!analysis_value,
set_values_to = set_values_to
set_values_to = exprs(
AVAL = !!analysis_value,
!!!set_values_to
)
)
}

Expand Down Expand Up @@ -271,6 +281,8 @@ compute_map <- function(diabp, sysbp, hr = NULL) {
#'
#' *Permitted Values:* list of variables
#'
#' @inheritParams derive_param_map
#'
#' @inheritParams derive_param_computed
#'
#' @inheritParams derive_param_qtc
Expand Down Expand Up @@ -423,8 +435,10 @@ derive_param_bsa <- function(dataset,
filter = !!filter,
parameters = parameters,
by_vars = by_vars,
analysis_value = !!bsa_formula,
set_values_to = set_values_to,
set_values_to = exprs(
AVAL = !!bsa_formula,
!!!set_values_to
),
constant_parameters = constant_parameters,
constant_by_vars = constant_by_vars
)
Expand Down Expand Up @@ -572,6 +586,8 @@ compute_bsa <- function(height = height,
#'
#' *Permitted Values:* list of variables
#'
#' @inheritParams derive_param_map
#'
#' @inheritParams derive_param_computed
#'
#' @inheritParams derive_param_qtc
Expand Down Expand Up @@ -710,8 +726,10 @@ derive_param_bmi <- function(dataset,
filter = !!filter,
parameters = parameters,
by_vars = by_vars,
analysis_value = !!bmi_formula,
set_values_to = set_values_to,
set_values_to = exprs(
AVAL = !!bmi_formula,
!!!set_values_to
),
constant_parameters = constant_parameters,
constant_by_vars = constant_by_vars
)
Expand Down
Loading

0 comments on commit 1d44b96

Please sign in to comment.