Skip to content

Commit

Permalink
#26: update input data
Browse files Browse the repository at this point in the history
  • Loading branch information
kaz462 committed Jul 18, 2023
1 parent 3c16e2b commit efcce34
Show file tree
Hide file tree
Showing 25 changed files with 77 additions and 13 deletions.
6 changes: 5 additions & 1 deletion data-raw/ae.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
library(dplyr)
library(admiral)
library(metatools)
library(haven)

data("raw_ae")
raw_ae <- read_xpt("https://github.com/cdisc-org/sdtm-adam-pilot-project/blob/master/updated-pilot-submission-package/900172/m5/datasets/cdiscpilot01/tabulations/sdtm/ae.xpt?raw=true") # nolint
raw_suppae <- read_xpt("https://github.com/cdisc-org/sdtm-adam-pilot-project/blob/master/updated-pilot-submission-package/900172/m5/datasets/cdiscpilot01/tabulations/sdtm/suppae.xpt?raw=true") # nolint
ae <- convert_blanks_to_na(raw_ae)
suppae <- convert_blanks_to_na(raw_suppae)

# create possible AELAT values - as collected on CRF ----
lat <- c("LEFT", "RIGHT", "BOTH")
Expand All @@ -26,3 +29,4 @@ attr(admiral_ae, "label") <- "Adverse Events"
# Save dataset ----
ae <- admiral_ae
save(ae, file = "data/ae.rda", compress = "bzip2")
usethis::use_data(suppae, overwrite = TRUE)
7 changes: 7 additions & 0 deletions data-raw/cm.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# from CDISC pilot study ----
library(haven)
library(admiral)
raw_cm <- read_xpt("https://github.com/cdisc-org/sdtm-adam-pilot-project/blob/master/updated-pilot-submission-package/900172/m5/datasets/cdiscpilot01/tabulations/sdtm/cm.xpt?raw=true") # nolint
cm <- convert_blanks_to_na(raw_cm)

usethis::use_data(cm, overwrite = TRUE)
11 changes: 11 additions & 0 deletions data-raw/dm.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# from CDISC pilot study ----
library(haven)
library(admiral)
sdtm_path <- "https://github.com/cdisc-org/sdtm-adam-pilot-project/blob/master/updated-pilot-submission-package/900172/m5/datasets/cdiscpilot01/tabulations/sdtm/" # nolint
raw_dm <- read_xpt(paste0(sdtm_path, "dm", ".xpt?raw=true"))
raw_suppdm <- read_xpt(paste0(sdtm_path, "suppdm", ".xpt?raw=true"))
dm <- convert_blanks_to_na(raw_dm)
suppdm <- convert_blanks_to_na(raw_suppdm)

usethis::use_data(dm, overwrite = TRUE)
usethis::use_data(suppdm, overwrite = TRUE)
10 changes: 6 additions & 4 deletions data-raw/ds.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ library(tidyselect)
library(labelled)
library(admiral)
library(metatools)
library(haven)

data("admiral_dm")
data("raw_ds")
data("raw_suppds")
data("dm")
sdtm_path <- "https://github.com/cdisc-org/sdtm-adam-pilot-project/blob/master/updated-pilot-submission-package/900172/m5/datasets/cdiscpilot01/tabulations/sdtm/" # nolint
raw_ds <- read_xpt(paste0(sdtm_path, "ds", ".xpt?raw=true"))
raw_suppds <- read_xpt(paste0(sdtm_path, "suppds", ".xpt?raw=true"))

# Converting blank to NA
dm <- convert_blanks_to_na(admiral_dm)
dm <- convert_blanks_to_na(dm)
ds1a <- convert_blanks_to_na(raw_ds)
suppds1a <- convert_blanks_to_na(raw_suppds)

Expand Down
7 changes: 7 additions & 0 deletions data-raw/ex.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# from CDISC pilot study ----
library(haven)
library(admiral)
raw_ex <- read_xpt("https://github.com/cdisc-org/sdtm-adam-pilot-project/blob/master/updated-pilot-submission-package/900172/m5/datasets/cdiscpilot01/tabulations/sdtm/ex.xpt?raw=true") # nolint
ex <- convert_blanks_to_na(raw_ex)

usethis::use_data(ex, overwrite = TRUE)
8 changes: 6 additions & 2 deletions data-raw/lb.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# Update LB by adding percentage differential lab test rows

library(dplyr)
library(haven)
library(admiral)

sdtm_path <- "https://github.com/cdisc-org/sdtm-adam-pilot-project/blob/master/updated-pilot-submission-package/900172/m5/datasets/cdiscpilot01/tabulations/sdtm/" # nolint
raw_lb <- read_xpt(paste0(sdtm_path, "lb", ".xpt?raw=true"))
lb <- raw_lb %>% convert_blanks_to_na()

data("raw_lb")
lb <- raw_lb

# Subset on differential lab tests
lb_diff_abs <- lb %>%
Expand Down
9 changes: 6 additions & 3 deletions data-raw/mh.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# Add new variables to MH
library(metatools)
library(lubridate)
library(haven)
library(admiral)

data("admiral_dm")
data("raw_mh")
data("dm")
sdtm_path <- "https://github.com/cdisc-org/sdtm-adam-pilot-project/blob/master/updated-pilot-submission-package/900172/m5/datasets/cdiscpilot01/tabulations/sdtm/" # nolint
raw_mh <- read_xpt(paste0(sdtm_path, "mh", ".xpt?raw=true"))

# Convert blank to NA
dm <- convert_blanks_to_na(admiral_dm) %>%
dm <- convert_blanks_to_na(dm) %>%
select(STUDYID, USUBJID, RFSTDTC, RFENDTC, RFXSTDTC, RFXENDTC)
mh <- convert_blanks_to_na(raw_mh)
# Set seed so that result stays the same for each run
Expand Down
11 changes: 8 additions & 3 deletions data-raw/qs.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@

library(metatools)
library(dplyr)
library(haven)
library(admiral)

# take qs test data from previous ADMIRAL project ====
data("raw_qs")

# create new QS data - keep standard variables from previous ADMIRAL project's QS ====
# from CDISC pilot study ----
sdtm_path <- "https://github.com/cdisc-org/sdtm-adam-pilot-project/blob/master/updated-pilot-submission-package/900172/m5/datasets/cdiscpilot01/tabulations/sdtm/" # nolint
raw_qs <- read_xpt(paste0(sdtm_path, "qs", ".xpt?raw=true")) %>%
convert_blanks_to_na()

# create new QS data - keep standard variables from previous ADMIRAL project's QS ----
qs1 <- raw_qs %>%
# select standard variables
select(STUDYID, DOMAIN, USUBJID, QSBLFL, VISITNUM, VISIT, VISITDY, QSDTC, QSDY) %>%
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions data-raw/sv.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# from CDISC pilot study ----
library(haven)
library(admiral)
raw_sv <- read_xpt("https://github.com/cdisc-org/sdtm-adam-pilot-project/blob/master/updated-pilot-submission-package/900172/m5/datasets/cdiscpilot01/tabulations/sdtm/sv.xpt?raw=true") # nolint
sv <- convert_blanks_to_na(raw_sv)

usethis::use_data(sv, overwrite = TRUE)
7 changes: 7 additions & 0 deletions data-raw/ts.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# from CDISC pilot study ----
library(haven)
library(admiral)
raw_ts <- read_xpt("https://github.com/cdisc-org/sdtm-adam-pilot-project/blob/master/updated-pilot-submission-package/900172/m5/datasets/cdiscpilot01/tabulations/sdtm/ts.xpt?raw=true") # nolint
ts <- convert_blanks_to_na(raw_ts)

usethis::use_data(ts, overwrite = TRUE)
7 changes: 7 additions & 0 deletions data-raw/vs.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# from CDISC pilot study ----
library(haven)
library(admiral)
raw_vs <- read_xpt("https://github.com/cdisc-org/sdtm-adam-pilot-project/blob/master/updated-pilot-submission-package/900172/m5/datasets/cdiscpilot01/tabulations/sdtm/vs.xpt?raw=true") # nolint
vs <- convert_blanks_to_na(raw_vs)

usethis::use_data(vs, overwrite = TRUE)

0 comments on commit efcce34

Please sign in to comment.