Skip to content

Commit

Permalink
Update ad_advs.R (#96)
Browse files Browse the repository at this point in the history
* Update ad_advs.R

The CHG and PCHG derivations were restricted to the post-baselines visits using restrict_derivation() with AVISITN > 0 condition as in the referenced #2484 in pharmaverse/admiral repository.

* Update NEWS.md

---------

Co-authored-by: Fanny Gautier <[email protected]>
  • Loading branch information
remikk and Fanny-Gautier authored Jan 8, 2025
1 parent b91cf49 commit 7396968
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
4 changes: 3 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

## Updates of Existing Functions

- `ADVS` template updated in line with {admiral} to calculate change from baseline variables only for post-baseline records (#95).

## Breaking Changes

## Documentation
Expand All @@ -16,4 +18,4 @@
# admiralpeds 0.1.0

- Initial package release focused mainly on Anthropometric indicators (i.e. child growth
development charts).
development charts).
16 changes: 12 additions & 4 deletions inst/templates/ad_advs.R
Original file line number Diff line number Diff line change
Expand Up @@ -456,10 +456,18 @@ advs <- advs %>%
source_var = AVAL,
new_var = BASE
) %>%
# Calculate CHG
derive_var_chg() %>%
# Calculate PCHG
derive_var_pchg()
# Calculate CHG for post-baseline records
# The decision on how to populate pre-baseline and baseline values of CHG is left to producer choice
restrict_derivation(
derivation = derive_var_chg,
filter = AVISITN > 0
) %>%
# Calculate PCHG for post-baseline records
# The decision on how to populate pre-baseline and baseline values of PCHG is left to producer choice
restrict_derivation(
derivation = derive_var_pchg,
filter = AVISITN > 0
)

## Calculate ONTRTFL ----
advs <- advs %>%
Expand Down

0 comments on commit 7396968

Please sign in to comment.