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 #2523 add more examples for derive_var_joined_exist_flag #2566

Merged
merged 5 commits into from
Nov 16, 2024
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
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ example, `">2.5 x ULN"` changed to `">2.5"` for grade 3. (#2534)

- `derive_locf_records()` documentation example was fixed to display LOCF records. (#2461)

- `derive_var_joined_exist_flag()` documentation updated with extra examples. (#2523)

## Various

<details>
Expand Down
52 changes: 52 additions & 0 deletions R/derive_var_joined_exist_flag.R
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,58 @@
#' first_cond_upper = val.join == "++",
#' filter_join = val == "0" & all(val.join %in% c("+", "++"))
#' )
#'
#' # flag each dose which is lower than the previous dose per subject
#' ex <- tribble(
#' ~USUBJID, ~EXSTDTM, ~EXDOSE,
#' "1", "2024-01-01T08:00", 2,
#' "1", "2024-01-02T08:00", 4,
#' "2", "2024-01-01T08:30", 1,
#' "2", "2024-01-02T08:30", 4,
#' "2", "2024-01-03T08:30", 3,
#' "2", "2024-01-04T08:30", 2,
#' "2", "2024-01-05T08:30", 2
#' )
#'
#' derive_var_joined_exist_flag(
#' ex,
#' dataset_add = ex,
#' by_vars = exprs(USUBJID),
#' order = exprs(EXSTDTM),
#' new_var = DOSREDFL,
#' tmp_obs_nr_var = tmp_dose_nr,
#' join_vars = exprs(EXDOSE),
#' join_type = "before",
#' filter_join = (
#' tmp_dose_nr == tmp_dose_nr.join + 1 # Look only at adjacent doses
#' & EXDOSE > 0 & EXDOSE.join > 0 # Both doses are valid
#' & EXDOSE < EXDOSE.join # Dose is lower than previous
#' )
#' )
#'
#' # derive definitive deterioration flag as any deterioration (CHGCAT1 = "Worsened")
#' # by parameter that is not followed by a non-deterioration
#' adqs <- tribble(
#' ~USUBJID, ~PARAMCD, ~ADY, ~CHGCAT1,
#' "1", "QS1", 10, "Improved",
#' "1", "QS1", 21, "Improved",
#' "1", "QS1", 23, "Improved",
#' "1", "QS2", 32, "Worsened",
#' "1", "QS2", 42, "Improved",
#' "2", "QS1", 11, "Worsened",
#' "2", "QS1", 24, "Worsened"
#' )
#'
#' derive_var_joined_exist_flag(
#' adqs,
#' dataset_add = adqs,
#' new_var = DDETERFL,
#' by_vars = exprs(USUBJID, PARAMCD),
#' join_vars = exprs(CHGCAT1),
#' join_type = "all",
#' order = exprs(ADY),
#' filter_join = all(CHGCAT1.join == "Worsened" | ADY > ADY.join)
#' )
derive_var_joined_exist_flag <- function(dataset,
dataset_add,
by_vars,
Expand Down
52 changes: 52 additions & 0 deletions man/derive_var_joined_exist_flag.Rd

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

Loading