Skip to content

Commit

Permalink
Closes #2546 Updating ABLFL to Null if not "Y" in derive_var_base()
Browse files Browse the repository at this point in the history
…example (#2560)

* Closes #2546 Updating ABLFL to Null if not "Y" in `derive_var_base()` example

* fixing styling

* fixing more styling

* Updated other ABLFL so that the blanks are NA_charater_

* Fixing Styler

* chore: #2546 alignment

* chore: #2546 alignment is my best friend

* chore: #2546 feel the align!

* chore: #2546 docs

* chore: #2546 moar NAs!!

---------

Co-authored-by: Ben Straub <[email protected]>
Co-authored-by: Stefan Bundfuss <[email protected]>
  • Loading branch information
3 people authored Dec 12, 2024
1 parent 4c0a8dc commit f295044
Show file tree
Hide file tree
Showing 14 changed files with 216 additions and 216 deletions.
26 changes: 13 additions & 13 deletions R/derive_var_base.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,19 @@
#' library(tibble)
#'
#' dataset <- tribble(
#' ~STUDYID, ~USUBJID, ~PARAMCD, ~AVAL, ~AVALC, ~AVISIT, ~ABLFL, ~ANRIND,
#' "TEST01", "PAT01", "PARAM01", 10.12, NA, "Baseline", "Y", "NORMAL",
#' "TEST01", "PAT01", "PARAM01", 9.700, NA, "Day 7", "N", "LOW",
#' "TEST01", "PAT01", "PARAM01", 15.01, NA, "Day 14", "N", "HIGH",
#' "TEST01", "PAT01", "PARAM02", 8.350, NA, "Baseline", "Y", "LOW",
#' "TEST01", "PAT01", "PARAM02", NA, NA, "Day 7", "N", NA,
#' "TEST01", "PAT01", "PARAM02", 8.350, NA, "Day 14", "N", "LOW",
#' "TEST01", "PAT01", "PARAM03", NA, "LOW", "Baseline", "Y", NA,
#' "TEST01", "PAT01", "PARAM03", NA, "LOW", "Day 7", "N", NA,
#' "TEST01", "PAT01", "PARAM03", NA, "MEDIUM", "Day 14", "N", NA,
#' "TEST01", "PAT01", "PARAM04", NA, "HIGH", "Baseline", "Y", NA,
#' "TEST01", "PAT01", "PARAM04", NA, "HIGH", "Day 7", "N", NA,
#' "TEST01", "PAT01", "PARAM04", NA, "MEDIUM", "Day 14", "N", NA
#' ~STUDYID, ~USUBJID, ~PARAMCD, ~AVAL, ~AVALC, ~AVISIT, ~ABLFL, ~ANRIND,
#' "TEST01", "PAT01", "PARAM01", 10.12, NA, "Baseline", "Y", "NORMAL",
#' "TEST01", "PAT01", "PARAM01", 9.700, NA, "Day 7", NA, "LOW",
#' "TEST01", "PAT01", "PARAM01", 15.01, NA, "Day 14", NA, "HIGH",
#' "TEST01", "PAT01", "PARAM02", 8.350, NA, "Baseline", "Y", "LOW",
#' "TEST01", "PAT01", "PARAM02", NA, NA, "Day 7", NA, NA,
#' "TEST01", "PAT01", "PARAM02", 8.350, NA, "Day 14", NA, "LOW",
#' "TEST01", "PAT01", "PARAM03", NA, "LOW", "Baseline", "Y", NA,
#' "TEST01", "PAT01", "PARAM03", NA, "LOW", "Day 7", NA, NA,
#' "TEST01", "PAT01", "PARAM03", NA, "MEDIUM", "Day 14", NA, NA,
#' "TEST01", "PAT01", "PARAM04", NA, "HIGH", "Baseline", "Y", NA,
#' "TEST01", "PAT01", "PARAM04", NA, "HIGH", "Day 7", NA, NA,
#' "TEST01", "PAT01", "PARAM04", NA, "MEDIUM", "Day 14", NA, NA
#' )
#'
#' ## Derive `BASE` variable from `AVAL`
Expand Down
6 changes: 3 additions & 3 deletions R/derive_var_chg.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
#' advs <- tribble(
#' ~USUBJID, ~PARAMCD, ~AVAL, ~ABLFL, ~BASE,
#' "P01", "WEIGHT", 80, "Y", 80,
#' "P01", "WEIGHT", 80.8, "", 80,
#' "P01", "WEIGHT", 81.4, "", 80,
#' "P01", "WEIGHT", 80.8, NA, 80,
#' "P01", "WEIGHT", 81.4, NA, 80,
#' "P02", "WEIGHT", 75.3, "Y", 75.3,
#' "P02", "WEIGHT", 76, "", 75.3
#' "P02", "WEIGHT", 76, NA, 75.3
#' )
#' derive_var_chg(advs)
derive_var_chg <- function(dataset) {
Expand Down
6 changes: 3 additions & 3 deletions R/derive_var_pchg.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
#' advs <- tribble(
#' ~USUBJID, ~PARAMCD, ~AVAL, ~ABLFL, ~BASE,
#' "P01", "WEIGHT", 80, "Y", 80,
#' "P01", "WEIGHT", 80.8, "", 80,
#' "P01", "WEIGHT", 81.4, "", 80,
#' "P01", "WEIGHT", 80.8, NA, 80,
#' "P01", "WEIGHT", 81.4, NA, 80,
#' "P02", "WEIGHT", 75.3, "Y", 75.3,
#' "P02", "WEIGHT", 76, "", 75.3
#' "P02", "WEIGHT", 76, NA, 75.3
#' )
#' derive_var_pchg(advs)
derive_var_pchg <- function(dataset) {
Expand Down
14 changes: 7 additions & 7 deletions R/derive_var_shift.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@
#' library(tibble)
#'
#' data <- tribble(
#' ~USUBJID, ~PARAMCD, ~AVAL, ~ABLFL, ~BNRIND, ~ANRIND,
#' "P01", "ALB", 33, "Y", "LOW", "LOW",
#' "P01", "ALB", 38, NA, "LOW", "NORMAL",
#' "P01", "ALB", NA, NA, "LOW", NA,
#' "P02", "ALB", 37, "Y", "NORMAL", "NORMAL",
#' "P02", "ALB", 49, NA, "NORMAL", "HIGH",
#' "P02", "SODIUM", 147, "Y", "HIGH", "HIGH"
#' ~USUBJID, ~PARAMCD, ~AVAL, ~ABLFL, ~BNRIND, ~ANRIND,
#' "P01", "ALB", 33, "Y", "LOW", "LOW",
#' "P01", "ALB", 38, NA, "LOW", "NORMAL",
#' "P01", "ALB", NA, NA, "LOW", NA,
#' "P02", "ALB", 37, "Y", "NORMAL", "NORMAL",
#' "P02", "ALB", 49, NA, "NORMAL", "HIGH",
#' "P02", "SODIUM", 147, "Y", "HIGH", "HIGH"
#' )
#'
#' data %>%
Expand Down
30 changes: 15 additions & 15 deletions R/derive_vars_computed.R
Original file line number Diff line number Diff line change
Expand Up @@ -134,24 +134,24 @@
#' # Example 1: Derive BMIBL
#' adsl <- tribble(
#' ~STUDYID, ~USUBJID, ~AGE, ~AGEU,
#' "PILOT01", "01-1302", 61, "YEARS",
#' "PILOT01", "17-1344", 64, "YEARS"
#' "PILOT01", "01-1302", 61, "YEARS",
#' "PILOT01", "17-1344", 64, "YEARS"
#' )
#'
#' advs <- tribble(
#' ~STUDYID, ~USUBJID, ~PARAMCD, ~PARAM, ~VISIT, ~AVAL, ~AVALU, ~ABLFL,
#' "PILOT01", "01-1302", "HEIGHT", "Height (cm)", "SCREENING", 177.8, "cm", "Y",
#' "PILOT01", "01-1302", "WEIGHT", "Weight (kg)", "SCREENING", 81.19, "kg", "N",
#' "PILOT01", "01-1302", "WEIGHT", "Weight (kg)", "BASELINE", 82.1, "kg", "Y",
#' "PILOT01", "01-1302", "WEIGHT", "Weight (kg)", "WEEK 2", 81.19, "kg", "N",
#' "PILOT01", "01-1302", "WEIGHT", "Weight (kg)", "WEEK 4", 82.56, "kg", "N",
#' "PILOT01", "01-1302", "WEIGHT", "Weight (kg)", "WEEK 6", 80.74, "kg", "N",
#' "PILOT01", "17-1344", "HEIGHT", "Height (cm)", "SCREENING", 163.5, "cm", "Y",
#' "PILOT01", "17-1344", "WEIGHT", "Weight (kg)", "SCREENING", 58.06, "kg", "N",
#' "PILOT01", "17-1344", "WEIGHT", "Weight (kg)", "BASELINE", 58.06, "kg", "Y",
#' "PILOT01", "17-1344", "WEIGHT", "Weight (kg)", "WEEK 2", 58.97, "kg", "N",
#' "PILOT01", "17-1344", "WEIGHT", "Weight (kg)", "WEEK 4", 57.97, "kg", "N",
#' "PILOT01", "17-1344", "WEIGHT", "Weight (kg)", "WEEK 6", 58.97, "kg", "N"
#' ~STUDYID, ~USUBJID, ~PARAMCD, ~PARAM, ~VISIT, ~AVAL, ~AVALU, ~ABLFL,
#' "PILOT01", "01-1302", "HEIGHT", "Height (cm)", "SCREENING", 177.8, "cm", "Y",
#' "PILOT01", "01-1302", "WEIGHT", "Weight (kg)", "SCREENING", 81.19, "kg", NA,
#' "PILOT01", "01-1302", "WEIGHT", "Weight (kg)", "BASELINE", 82.1, "kg", "Y",
#' "PILOT01", "01-1302", "WEIGHT", "Weight (kg)", "WEEK 2", 81.19, "kg", NA,
#' "PILOT01", "01-1302", "WEIGHT", "Weight (kg)", "WEEK 4", 82.56, "kg", NA,
#' "PILOT01", "01-1302", "WEIGHT", "Weight (kg)", "WEEK 6", 80.74, "kg", NA,
#' "PILOT01", "17-1344", "HEIGHT", "Height (cm)", "SCREENING", 163.5, "cm", "Y",
#' "PILOT01", "17-1344", "WEIGHT", "Weight (kg)", "SCREENING", 58.06, "kg", NA,
#' "PILOT01", "17-1344", "WEIGHT", "Weight (kg)", "BASELINE", 58.06, "kg", "Y",
#' "PILOT01", "17-1344", "WEIGHT", "Weight (kg)", "WEEK 2", 58.97, "kg", NA,
#' "PILOT01", "17-1344", "WEIGHT", "Weight (kg)", "WEEK 4", 57.97, "kg", NA,
#' "PILOT01", "17-1344", "WEIGHT", "Weight (kg)", "WEEK 6", 58.97, "kg", NA
#' )
#'
#' derive_vars_computed(
Expand Down
26 changes: 13 additions & 13 deletions man/derive_var_base.Rd

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

6 changes: 3 additions & 3 deletions man/derive_var_chg.Rd

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

6 changes: 3 additions & 3 deletions man/derive_var_pchg.Rd

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

14 changes: 7 additions & 7 deletions man/derive_var_shift.Rd

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

30 changes: 15 additions & 15 deletions man/derive_vars_computed.Rd

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

Loading

0 comments on commit f295044

Please sign in to comment.