Skip to content

Commit

Permalink
Closes #2498 update data("sdtm") in templates and vignettes (#2509)
Browse files Browse the repository at this point in the history
* #2498 update data("sdtm") in templates and vignettes

* run styler

* #2498 update spacing to be consistent
  • Loading branch information
jeffreyad authored Sep 20, 2024
1 parent 9855c33 commit d69ebd2
Show file tree
Hide file tree
Showing 25 changed files with 75 additions and 115 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
- New function `derive_vars_crit_flag()` for deriving criterion flag variables
(`CRITy`, `CRITyFL`, `CRITyFLN`). (#2468)

- Replace use of `data("sdtm")` with `sdtm <- pharmaverse::sdtm` in templates and vignettes. (#2498)

## Updates of Existing Functions

## Breaking Changes
Expand Down
2 changes: 1 addition & 1 deletion inst/example_scripts/derive_single_dose.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
library(pharmaversesdtm)
library(admiral)
library(dplyr)
data(ex)
ex <- pharmaversesdtm::ex

# check that there is only one start/end date of exposure per subject and visit
check_cond <- ex %>%
Expand Down
10 changes: 4 additions & 6 deletions inst/templates/ad_adae.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@ library(lubridate)
# as needed and assign to the variables below.
# For illustration purposes read in admiral test data

data("ae")
data("admiral_adsl")
data("ex_single")
data("suppae")

adsl <- admiral_adsl
ae <- pharmaversesdtm::ae
suppae <- pharmaversesdtm::suppae
adsl <- admiral::admiral_adsl
ex_single <- admiral::ex_single

# When SAS datasets are imported into R using haven::read_sas(), missing
# character values from SAS appear as "" characters in R, instead of appearing
Expand Down
6 changes: 2 additions & 4 deletions inst/templates/ad_adcm.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ library(lubridate)
# as needed and assign to the variables below.
# For illustration purposes read in admiral test data

data("cm")
data("admiral_adsl")

adsl <- admiral_adsl
cm <- pharmaversesdtm::cm
adsl <- admiral::admiral_adsl

# When SAS datasets are imported into R using haven::read_sas(), missing
# character values from SAS appear as "" characters in R, instead of appearing
Expand Down
7 changes: 2 additions & 5 deletions inst/templates/ad_adeg.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@ library(stringr)
# as needed and assign to the variables below.
# For illustration purposes read in admiral test data

data("admiral_adsl")
data("eg")

adsl <- admiral_adsl
eg <- eg
eg <- pharmaversesdtm::eg
adsl <- admiral::admiral_adsl

# When SAS datasets are imported into R using haven::read_sas(), missing
# character values from SAS appear as "" characters in R, instead of appearing
Expand Down
5 changes: 2 additions & 3 deletions inst/templates/ad_adex.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ library(stringr)
# Use e.g. haven::read_sas to read in .sas7bdat, or other suitable functions
# as needed and assign to the variables below.
# The CDISC pilot datasets are used for demonstration purpose.
data("admiral_adsl")
data("ex")

adsl <- admiral_adsl
ex <- pharmaversesdtm::ex
adsl <- admiral::admiral_adsl

# When SAS datasets are imported into R using haven::read_sas(), missing
# character values from SAS appear as "" characters in R, instead of appearing
Expand Down
6 changes: 2 additions & 4 deletions inst/templates/ad_adlb.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ library(stringr)
# as needed and assign to the variables below.
# For illustration purposes read in admiral test data

data("lb")
data("admiral_adsl")

adsl <- admiral_adsl
lb <- pharmaversesdtm::lb
adsl <- admiral::admiral_adsl

# When SAS datasets are imported into R using haven::read_sas(), missing
# character values from SAS appear as "" characters in R, instead of appearing
Expand Down
4 changes: 1 addition & 3 deletions inst/templates/ad_adlbhy.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ library(lubridate)
# ADLBHY is a special dataset specifically used to check for potential drug induced liver injuries
# Please see "Hy's Law Implementation Guide" on the admiral website for additional information


data("admiral_adlb")
adlb <- admiral_adlb
adlb <- admiral::admiral_adlb

adlb_annotated <- adlb %>%
filter(PARAMCD %in% c("AST", "ALT", "BILI") & is.na(DTYPE)) %>%
Expand Down
13 changes: 8 additions & 5 deletions inst/templates/ad_admh.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@ library(lubridate)
# Use e.g. haven::read_sas to read in .sas7bdat, or other suitable functions
# as needed and assign to the variables below.
# For illustration purposes read in admiral test data
data("mh")
data("admiral_adsl")
data("queries_mh")

adsl <- admiral_adsl
mh <- pharmaversesdtm::mh
queries_mh <- admiral::queries_mh
adsl <- admiral::admiral_adsl

mh <- convert_blanks_to_na(mh)
# When SAS datasets are imported into R using haven::read_sas(), missing
# character values from SAS appear as "" characters in R, instead of appearing
# as NA values. Further details can be obtained via the following link:
# https://pharmaverse.github.io/admiral/articles/admiral.html#handling-of-missing-values # nolint

mh <- convert_blanks_to_na(mh)

# Look-up tables ----

Expand Down
20 changes: 4 additions & 16 deletions inst/templates/ad_adpc.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,19 @@ library(pharmaversesdtm) # Contains example datasets from the CDISC pilot projec
# as needed and assign to the variables below.
# For illustration purposes read in admiral test data


# Load PC, EX, VS and ADSL
data("pc")
data("ex")
data("vs")

data("admiral_adsl")

adsl <- admiral_adsl
pc <- pharmaversesdtm::pc
ex <- pharmaversesdtm::ex
vs <- pharmaversesdtm::vs
adsl <- admiral::admiral_adsl

# When SAS datasets are imported into R using haven::read_sas(), missing
# character values from SAS appear as "" characters in R, instead of appearing
# as NA values. Further details can be obtained via the following link:
# https://pharmaverse.github.io/admiral/articles/admiral.html#handling-of-missing-values # nolint

# Load EX

ex <- convert_blanks_to_na(ex)

# Load PC

pc <- convert_blanks_to_na(pc)

# Load VS for baseline height and weight

vs <- convert_blanks_to_na(vs)

# ---- Lookup tables ----
Expand Down
4 changes: 2 additions & 2 deletions inst/templates/ad_adpp.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ library(stringr)
# For illustration purposes read in admiral test data

# Load PP and Adsl
data("pp")
data("admiral_adsl")
pp <- pharmaversesdtm::pp
admiral_adsl <- admiral::admiral_adsl

# When SAS datasets are imported into R using haven::read_sas(), missing
# character values from SAS appear as "" characters in R, instead of appearing
Expand Down
13 changes: 5 additions & 8 deletions inst/templates/ad_adppk.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,11 @@ library(pharmaversesdtm) # Contains example datasets from the CDISC pilot projec
# For illustration purposes read in admiral test data

# Load PC, EX, VS, LB and ADSL
data("pc")
data("ex")
data("vs")
data("lb")

data("admiral_adsl")

adsl <- admiral_adsl
pc <- pharmaversesdtm::pc
ex <- pharmaversesdtm::ex
vs <- pharmaversesdtm::vs
lb <- pharmaversesdtm::lb
adsl <- admiral::admiral_adsl

# When SAS datasets are imported into R using haven::read_sas(), missing
# character values from SAS appear as "" characters in R, instead of appearing
Expand Down
10 changes: 5 additions & 5 deletions inst/templates/ad_adsl.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ library(stringr)
# as needed and assign to the variables below.
# For illustration purposes read in admiral test data

data("dm")
data("ds")
data("ex")
data("ae")
data("lb")
dm <- pharmaversesdtm::dm
ds <- pharmaversesdtm::ds
ex <- pharmaversesdtm::ex
ae <- pharmaversesdtm::ae
lb <- pharmaversesdtm::lb

# When SAS datasets are imported into R using haven::read_sas(), missing
# character values from SAS appear as "" characters in R, instead of appearing
Expand Down
6 changes: 2 additions & 4 deletions inst/templates/ad_advs.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ library(stringr)
# as needed and assign to the variables below.
# For illustration purposes read in admiral test data

data("vs")
data("admiral_adsl")

adsl <- admiral_adsl
vs <- pharmaversesdtm::vs
adsl <- admiral::admiral_adsl

# When SAS datasets are imported into R using haven::read_sas(), missing
# character values from SAS appear as "" characters in R, instead of appearing
Expand Down
10 changes: 5 additions & 5 deletions vignettes/admiral.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ library(pharmaversesdtm)
library(admiral)
# Read in SDTM datasets
data("dm")
data("ds")
data("ex")
data("vs")
data("admiral_adsl")
dm <- pharmaversesdtm::dm
ds <- pharmaversesdtm::ds
ex <- pharmaversesdtm::ex
vs <- pharmaversesdtm::vs
admiral_adsl <- admiral::admiral_adsl
```

The `adsl` and `advs` objects will now be prepared to showcase [addition of variables](#addvars)
Expand Down
10 changes: 5 additions & 5 deletions vignettes/adsl.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ library(pharmaversesdtm)
library(lubridate)
library(stringr)
data("dm")
data("ds")
data("ex")
data("ae")
data("lb")
dm <- pharmaversesdtm::dm
ds <- pharmaversesdtm::ds
ex <- pharmaversesdtm::ex
ae <- pharmaversesdtm::ae
lb <- pharmaversesdtm::lb
dm <- convert_blanks_to_na(dm)
ds <- convert_blanks_to_na(ds)
Expand Down
5 changes: 2 additions & 3 deletions vignettes/bds_exposure.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,9 @@ library(lubridate)
library(stringr)
library(tibble)
data("admiral_adsl")
data("ex")
ex <- pharmaversesdtm::ex
adsl <- admiral::admiral_adsl
adsl <- admiral_adsl
ex <- convert_blanks_to_na(ex)
```
```{r echo=FALSE}
Expand Down
5 changes: 2 additions & 3 deletions vignettes/bds_finding.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,9 @@ library(lubridate)
library(stringr)
library(tibble)
data("admiral_adsl")
data("vs")
vs <- pharmaversesdtm::vs
adsl <- admiral::admiral_adsl
adsl <- admiral_adsl
vs <- convert_blanks_to_na(vs)
```
```{r echo=FALSE}
Expand Down
5 changes: 2 additions & 3 deletions vignettes/bds_tte.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,10 @@ For example purpose, the ADSL dataset---which is included
in `{admiral}`---and the SDTM datasets from `{pharmaversesdtm}` are used.

```{r}
data("ae")
data("admiral_adsl")
ae <- pharmaversesdtm::ae
adsl <- admiral::admiral_adsl
ae <- convert_blanks_to_na(ae)
adsl <- admiral_adsl
```

```{r echo=FALSE}
Expand Down
8 changes: 4 additions & 4 deletions vignettes/higher_order.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ library(admiral)
library(pharmaversesdtm)
library(dplyr, warn.conflicts = FALSE)
data("admiral_adsl")
data("ae")
data("vs")
adsl <- admiral_adsl
ae <- pharmaversesdtm::ae
vs <- pharmaversesdtm::vs
adsl <- admiral::admiral_adsl
ae <- convert_blanks_to_na(ae)
vs <- convert_blanks_to_na(vs)
```
Expand Down
3 changes: 1 addition & 2 deletions vignettes/hys_law.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ We assume that an `ADLB` dataset is available [^1].
First we read in the `ADLB` parameters required for the Hy's Law parameters:

```{r, eval = TRUE}
data(admiral_adlb)
adlb <- admiral_adlb %>%
adlb <- admiral::admiral_adlb %>%
filter(PARAMCD %in% c("AST", "ALT", "BILI") & is.na(DTYPE))
```

Expand Down
4 changes: 2 additions & 2 deletions vignettes/lab_grading.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ library(dplyr, warn.conflicts = FALSE)
library(stringr)
library(tibble)
data("lb")
lb <- pharmaversesdtm::lb
adsl <- admiral::admiral_adsl
adsl <- admiral_adsl
lb <- convert_blanks_to_na(lb)
```
```{r echo=FALSE}
Expand Down
9 changes: 4 additions & 5 deletions vignettes/occds.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ library(dplyr, warn.conflicts = FALSE)
library(pharmaversesdtm)
library(lubridate)
data("ae")
data("admiral_adsl")
ae <- pharmaversesdtm::ae
adsl <- admiral::admiral_adsl
ex_single <- admiral::ex_single
ae <- convert_blanks_to_na(ae)
adsl <- admiral_adsl
```
```{r echo = FALSE}
ae <- filter(ae, USUBJID %in% c("01-701-1015", "01-701-1023", "01-703-1086", "01-703-1096", "01-707-1037", "01-716-1024"))
Expand Down Expand Up @@ -228,7 +228,6 @@ vignette](visits_periods.html#treatment_bds).
The function `derive_vars_joined()` can be used to derive the last dose date before the start of the event.

```{r eval=TRUE}
data(ex_single)
ex_single <- derive_vars_dtm(
ex_single,
dtc = EXSTDTC,
Expand Down Expand Up @@ -424,7 +423,7 @@ The following example shows how to derive query variables for Standardized MedDR
Queries (SMQs) in ADAE.

```{r, eval=TRUE}
data("queries")
queries <- admiral::queries
```

```{r, eval=TRUE, echo=FALSE}
Expand Down
20 changes: 5 additions & 15 deletions vignettes/pk_adnca.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -111,25 +111,15 @@ library(lubridate)
library(stringr)
library(tibble)
data("admiral_adsl")
data("ex")
data("pc")
data("vs")
data("lb")
ex <- pharmaversesdtm::ex
pc <- pharmaversesdtm::pc
vs <- pharmaversesdtm::vs
lb <- pharmaversesdtm::lb
adsl <- admiral::admiral_adsl
adsl <- admiral_adsl
ex <- convert_blanks_to_na(ex)
# Load PC
pc <- convert_blanks_to_na(pc)
# Load VS for baseline height and weight
vs <- convert_blanks_to_na(vs)
# Load LB for baseline lab values
lb <- convert_blanks_to_na(lb) %>%
filter(LBBLFL == "Y")
Expand Down
Loading

0 comments on commit d69ebd2

Please sign in to comment.