From efcce34f24595ede30c0bbb7141feaa32b6ae030 Mon Sep 17 00:00:00 2001 From: kaz462 Date: Tue, 18 Jul 2023 13:15:16 -0700 Subject: [PATCH] #26: update input data --- data-raw/ae.R | 6 +++++- data-raw/cm.R | 7 +++++++ data-raw/dm.R | 11 +++++++++++ data-raw/ds.R | 10 ++++++---- data-raw/ex.R | 7 +++++++ data-raw/lb.R | 8 ++++++-- data-raw/mh.R | 9 ++++++--- data-raw/qs.R | 11 ++++++++--- data-raw/{ => raw_domain}/raw_ae.rda | Bin data-raw/{ => raw_domain}/raw_cm.rda | Bin data-raw/{ => raw_domain}/raw_dm.rda | Bin data-raw/{ => raw_domain}/raw_ds.rda | Bin data-raw/{ => raw_domain}/raw_ex.rda | Bin data-raw/{ => raw_domain}/raw_lb.rda | Bin data-raw/{ => raw_domain}/raw_mh.rda | Bin data-raw/{ => raw_domain}/raw_qs.rda | Bin data-raw/{ => raw_domain}/raw_suppae.rda | Bin data-raw/{ => raw_domain}/raw_suppdm.rda | Bin data-raw/{ => raw_domain}/raw_suppds.rda | Bin data-raw/{ => raw_domain}/raw_sv.rda | Bin data-raw/{ => raw_domain}/raw_ts.rda | Bin data-raw/{ => raw_domain}/raw_vs.rda | Bin data-raw/sv.R | 7 +++++++ data-raw/ts.R | 7 +++++++ data-raw/vs.R | 7 +++++++ 25 files changed, 77 insertions(+), 13 deletions(-) create mode 100644 data-raw/cm.R create mode 100644 data-raw/dm.R create mode 100644 data-raw/ex.R rename data-raw/{ => raw_domain}/raw_ae.rda (100%) rename data-raw/{ => raw_domain}/raw_cm.rda (100%) rename data-raw/{ => raw_domain}/raw_dm.rda (100%) rename data-raw/{ => raw_domain}/raw_ds.rda (100%) rename data-raw/{ => raw_domain}/raw_ex.rda (100%) rename data-raw/{ => raw_domain}/raw_lb.rda (100%) rename data-raw/{ => raw_domain}/raw_mh.rda (100%) rename data-raw/{ => raw_domain}/raw_qs.rda (100%) rename data-raw/{ => raw_domain}/raw_suppae.rda (100%) rename data-raw/{ => raw_domain}/raw_suppdm.rda (100%) rename data-raw/{ => raw_domain}/raw_suppds.rda (100%) rename data-raw/{ => raw_domain}/raw_sv.rda (100%) rename data-raw/{ => raw_domain}/raw_ts.rda (100%) rename data-raw/{ => raw_domain}/raw_vs.rda (100%) create mode 100644 data-raw/sv.R create mode 100644 data-raw/ts.R create mode 100644 data-raw/vs.R diff --git a/data-raw/ae.R b/data-raw/ae.R index fa12bd1..a098453 100644 --- a/data-raw/ae.R +++ b/data-raw/ae.R @@ -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") @@ -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) diff --git a/data-raw/cm.R b/data-raw/cm.R new file mode 100644 index 0000000..2657e4e --- /dev/null +++ b/data-raw/cm.R @@ -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) diff --git a/data-raw/dm.R b/data-raw/dm.R new file mode 100644 index 0000000..e35f39f --- /dev/null +++ b/data-raw/dm.R @@ -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) diff --git a/data-raw/ds.R b/data-raw/ds.R index 0993abf..1ba12ea 100644 --- a/data-raw/ds.R +++ b/data-raw/ds.R @@ -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) diff --git a/data-raw/ex.R b/data-raw/ex.R new file mode 100644 index 0000000..20d31d1 --- /dev/null +++ b/data-raw/ex.R @@ -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) diff --git a/data-raw/lb.R b/data-raw/lb.R index 2d3b13b..5ceaa66 100644 --- a/data-raw/lb.R +++ b/data-raw/lb.R @@ -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 %>% diff --git a/data-raw/mh.R b/data-raw/mh.R index 1fe6dd0..3ac5e93 100644 --- a/data-raw/mh.R +++ b/data-raw/mh.R @@ -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 diff --git a/data-raw/qs.R b/data-raw/qs.R index feeac38..bc8c4cc 100644 --- a/data-raw/qs.R +++ b/data-raw/qs.R @@ -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) %>% diff --git a/data-raw/raw_ae.rda b/data-raw/raw_domain/raw_ae.rda similarity index 100% rename from data-raw/raw_ae.rda rename to data-raw/raw_domain/raw_ae.rda diff --git a/data-raw/raw_cm.rda b/data-raw/raw_domain/raw_cm.rda similarity index 100% rename from data-raw/raw_cm.rda rename to data-raw/raw_domain/raw_cm.rda diff --git a/data-raw/raw_dm.rda b/data-raw/raw_domain/raw_dm.rda similarity index 100% rename from data-raw/raw_dm.rda rename to data-raw/raw_domain/raw_dm.rda diff --git a/data-raw/raw_ds.rda b/data-raw/raw_domain/raw_ds.rda similarity index 100% rename from data-raw/raw_ds.rda rename to data-raw/raw_domain/raw_ds.rda diff --git a/data-raw/raw_ex.rda b/data-raw/raw_domain/raw_ex.rda similarity index 100% rename from data-raw/raw_ex.rda rename to data-raw/raw_domain/raw_ex.rda diff --git a/data-raw/raw_lb.rda b/data-raw/raw_domain/raw_lb.rda similarity index 100% rename from data-raw/raw_lb.rda rename to data-raw/raw_domain/raw_lb.rda diff --git a/data-raw/raw_mh.rda b/data-raw/raw_domain/raw_mh.rda similarity index 100% rename from data-raw/raw_mh.rda rename to data-raw/raw_domain/raw_mh.rda diff --git a/data-raw/raw_qs.rda b/data-raw/raw_domain/raw_qs.rda similarity index 100% rename from data-raw/raw_qs.rda rename to data-raw/raw_domain/raw_qs.rda diff --git a/data-raw/raw_suppae.rda b/data-raw/raw_domain/raw_suppae.rda similarity index 100% rename from data-raw/raw_suppae.rda rename to data-raw/raw_domain/raw_suppae.rda diff --git a/data-raw/raw_suppdm.rda b/data-raw/raw_domain/raw_suppdm.rda similarity index 100% rename from data-raw/raw_suppdm.rda rename to data-raw/raw_domain/raw_suppdm.rda diff --git a/data-raw/raw_suppds.rda b/data-raw/raw_domain/raw_suppds.rda similarity index 100% rename from data-raw/raw_suppds.rda rename to data-raw/raw_domain/raw_suppds.rda diff --git a/data-raw/raw_sv.rda b/data-raw/raw_domain/raw_sv.rda similarity index 100% rename from data-raw/raw_sv.rda rename to data-raw/raw_domain/raw_sv.rda diff --git a/data-raw/raw_ts.rda b/data-raw/raw_domain/raw_ts.rda similarity index 100% rename from data-raw/raw_ts.rda rename to data-raw/raw_domain/raw_ts.rda diff --git a/data-raw/raw_vs.rda b/data-raw/raw_domain/raw_vs.rda similarity index 100% rename from data-raw/raw_vs.rda rename to data-raw/raw_domain/raw_vs.rda diff --git a/data-raw/sv.R b/data-raw/sv.R new file mode 100644 index 0000000..8313e0c --- /dev/null +++ b/data-raw/sv.R @@ -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) diff --git a/data-raw/ts.R b/data-raw/ts.R new file mode 100644 index 0000000..284414e --- /dev/null +++ b/data-raw/ts.R @@ -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) diff --git a/data-raw/vs.R b/data-raw/vs.R new file mode 100644 index 0000000..748cd25 --- /dev/null +++ b/data-raw/vs.R @@ -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)