Skip to content

Commit

Permalink
#26: update program name/rerun
Browse files Browse the repository at this point in the history
  • Loading branch information
kaz462 committed Jul 18, 2023
1 parent efcce34 commit fd772f3
Show file tree
Hide file tree
Showing 50 changed files with 47 additions and 49 deletions.
7 changes: 4 additions & 3 deletions data-raw/ex_ophtha.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
library(dplyr)
library(tidyselect)
library(pharmaversesdtm)
data("dm")
data("ex")

# Make ex_ophtha dataset
ex_ophtha <- admiral_dm %>%
ex_ophtha <- dm %>%
# Start by merging on ophtha_dm to use the SUBJID variable
select(USUBJID, SUBJID) %>%
right_join(admiral_ex, by = c("USUBJID"), multiple = "all") %>%
right_join(ex, by = c("USUBJID"), multiple = "all") %>%
# Create EXLOC & EXLAT, change EXROUTE & EXDOSFRM to something eye-related
mutate(
EXLOC = "EYE",
Expand Down
1 change: 1 addition & 0 deletions data-raw/mh.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ library(metatools)
library(lubridate)
library(haven)
library(admiral)
library(dplyr)

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
Expand Down
14 changes: 7 additions & 7 deletions data-raw/oe.R → data-raw/oe_ophtha.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ library(tidyselect)
library(admiral)

# Read in data
data("admiral_dm")
data("admiral_sv")
data("dm")
data("sv")

# Convert blank to NA
dm <- convert_blanks_to_na(admiral_dm)
sv <- convert_blanks_to_na(admiral_sv)
dm <- convert_blanks_to_na(dm)
sv <- convert_blanks_to_na(sv)

# set seed to get same results each run
set.seed(999)
Expand Down Expand Up @@ -108,7 +108,7 @@ oe4 <- bind_rows(oe31, oe32, oe33, oe34) %>%
"OETPTNUM" = NA
)

oe <- oe4 %>%
oe_ophtha <- oe4 %>%
select(
STUDYID, DOMAIN, USUBJID, OESEQ, OECAT, OESCAT, OEDTC, VISIT, VISITNUM, VISITDY,
OESTRESN, OESTRESC, OEORRES, OETEST, OETESTCD, OETSTDTL, OELAT, OELOC, OEDY,
Expand Down Expand Up @@ -142,7 +142,7 @@ oe <- oe4 %>%
OETPTNUM = "Planned Time Point Number"
)

attr(oe, "label") <- "Ophthalmic Examinations"
attr(oe_ophtha, "label") <- "Ophthalmic Examinations"


save(oe, file = "data/oe.rda", compress = "bzip2")
save(oe_ophtha, file = "data/oe_ophtha.rda", compress = "bzip2")
6 changes: 2 additions & 4 deletions data-raw/pc.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ library(ggplot2)
library(labelled)
library(admiral)

data("admiral_ex")
data("admiral_dm")
ex <- admiral_ex
dm <- admiral_dm
data("ex")
data("dm")

# set seed to get same results each run
set.seed(999)
Expand Down
8 changes: 4 additions & 4 deletions data-raw/qs_ophtha.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
library(pharmaversesdtm)
library(dplyr)
library(stringr)
data("qs")

# create new QS data - keep standard variables from previous ADMIRAL project's QS ====
qs1 <- admiral_qs %>%
qs1 <- qs %>%
# select standard variables
select(STUDYID, DOMAIN, USUBJID, QSBLFL, VISITNUM, VISIT, VISITDY, QSDTC, QSDY) %>%
# keep unique subjects and visits per subject
Expand Down Expand Up @@ -119,10 +119,10 @@ qs3 <- qs2 %>%
) %>%
ungroup()

# NOTE: the QS2 dataset made above should be stacked below the admiral_qs dataset.
# NOTE: the QS2 dataset made above should be stacked below the qs dataset.
# output qs_ophtha.RDS
# remove the original vfq part from admiral_qs
admiral_qs_novfq <- admiral_qs %>% filter(QSCAT != "NEI VFQ-25")
admiral_qs_novfq <- qs %>% filter(QSCAT != "NEI VFQ-25")

qs_ophtha <- rbind(admiral_qs_novfq, qs3)

Expand Down
10 changes: 5 additions & 5 deletions data-raw/rs.R → data-raw/rs_onco.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ library(admiral)
library(metatools)

# Reading input data
data("admiral_tr")
data("tr")

# Converting blank to NA
tr <- convert_blanks_to_na(admiral_tr)
tr <- convert_blanks_to_na(tr)

keyvar <- c(
"STUDYID", "USUBJID", "TREVAL", "TREVALID",
Expand Down Expand Up @@ -188,7 +188,7 @@ rs <- select(rs6, c(
VISITNUM, VISIT, RSDTC, RSDY
))

rs <- rs %>% add_labels(
rs_onco <- rs %>% add_labels(
STUDYID = "Study Identifier",
DOMAIN = "Domain Abbreviation",
USUBJID = "Unique Subject Identifier",
Expand All @@ -210,6 +210,6 @@ rs <- rs %>% add_labels(
RSDY = "Study Day of Response Assessment"
)

attr(rs, "label") <- "Disease Response"
attr(rs_onco, "label") <- "Disease Response"

save(rs, file = "data/rs.rda", compress = "bzip2")
save(rs_onco, file = "data/rs_onco.rda", compress = "bzip2")
12 changes: 5 additions & 7 deletions data-raw/sc.R → data-raw/sc_ophtha.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
library(dplyr)
library(metatools)

data("admiral_dm")
data("admiral_sv")
data("dm")
data("sv")

dm <- admiral_dm
sv <- admiral_sv

# Remove screen failures, they will not make it to drug infusion
dm1 <- dm %>%
Expand Down Expand Up @@ -42,7 +40,7 @@ sc_seq <- sc %>%
"SCCAT", "SCORRES", "SCSTRESC", "EPOCH", "SCDTC", "SCDY"
)

sc <- sc_seq %>%
sc_ophtha <- sc_seq %>%
ungroup() %>%
# Sort data
arrange(STUDYID, USUBJID, SCSEQ) %>%
Expand All @@ -64,7 +62,7 @@ sc <- sc_seq %>%


# assign dataset label
attr(sc, "label") <- "Subject Characteristic"
attr(sc_ophtha, "label") <- "Subject Characteristic"

# Save output
save(sc, file = "data/sc.rda", compress = "bzip2")
save(sc_ophtha, file = "data/sc_ophtha.rda", compress = "bzip2")
24 changes: 12 additions & 12 deletions data-raw/tr.R → data-raw/tr_onco.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ library(metatools)
set.seed(1)

# Reading input data ----
data("admiral_dm")
data("admiral_suppdm")
data("admiral_sv")
data("dm")
data("suppdm")
data("sv")

# Converting blank to NA
dm <- convert_blanks_to_na(admiral_dm)
suppdm <- convert_blanks_to_na(admiral_suppdm)
sv <- convert_blanks_to_na(admiral_sv)
dm <- convert_blanks_to_na(dm)
suppdm <- convert_blanks_to_na(suppdm)
sv <- convert_blanks_to_na(sv)

# Creating data frame with visits ----
dm1 <- dm %>%
Expand Down Expand Up @@ -342,7 +342,7 @@ supptr <- select(
)
)

supptr <- supptr %>% add_labels(
supptr_onco <- supptr %>% add_labels(
STUDYID = "Study Identifier",
RDOMAIN = "Related Domain Abbreviation",
USUBJID = "Unique Subject Identifier",
Expand All @@ -354,7 +354,7 @@ supptr <- supptr %>% add_labels(
QORIG = "Origin"
)

attr(supptr, "label") <- "Supplemental Tumor Results"
attr(supptr_onco, "label") <- "Supplemental Tumor Results"

# Creating TR ----
tr <- select(tr, c(
Expand All @@ -364,7 +364,7 @@ tr <- select(tr, c(
TREVAL, TREVALID, TRACPTFL, VISITNUM, VISIT, TRDTC, TRDY
))

tr <- tr %>% add_labels(
tr_onco <- tr %>% add_labels(
STUDYID = "Study Identifier",
DOMAIN = "Domain Abbreviation",
USUBJID = "Unique Subject Identifier",
Expand All @@ -391,8 +391,8 @@ tr <- tr %>% add_labels(
TRDY = "Study Day of Tumor Measurement"
)

attr(tr, "label") <- "Tumor Results"
attr(tr_onco, "label") <- "Tumor Results"


save(tr, file = "data/tr.rda", compress = "bzip2")
save(supptr, file = "data/supptr.rda", compress = "bzip2")
save(tr_onco, file = "data/tr_onco.rda", compress = "bzip2")
save(supptr_onco, file = "data/supptr_onco.rda", compress = "bzip2")
14 changes: 7 additions & 7 deletions data-raw/tu.R → data-raw/tu_onco.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ library(admiral)
library(metatools)

# Reading input data -- DUMMY DATA CREATED FROM TR data created from TR
data("admiral_tr")
data("admiral_supptr")
data("tr")
data("supptr")

tr <- convert_blanks_to_na(admiral_tr)
supptr <- convert_blanks_to_na(admiral_supptr)
tr <- convert_blanks_to_na(tr)
supptr <- convert_blanks_to_na(supptr)

supptr1 <- supptr %>%
mutate("DOMAIN" = RDOMAIN, TRSEQ = as.numeric(IDVARVAL), "TRLOC" = QVAL) %>%
Expand Down Expand Up @@ -58,7 +58,7 @@ tu <- select(tu2, c(
VISITNUM, VISIT, TUDTC, TUDY
))

tu <- tu %>% add_labels(
tu_onco <- tu %>% add_labels(
STUDYID = "Study Identifier",
DOMAIN = "Domain Abbreviation",
USUBJID = "Unique Subject Identifier",
Expand All @@ -79,6 +79,6 @@ tu <- tu %>% add_labels(
TUDY = "Study Day of Tumor Identification"
)

attr(tu, "label") <- "Tumor Identification"
attr(tu_onco, "label") <- "Tumor Identification"

save(tu, file = "data/tu.rda", compress = "bzip2")
save(tu_onco, file = "data/tu_onco.rda", compress = "bzip2")
Binary file removed data/admiral_ae.rda
Binary file not shown.
Binary file removed data/admiral_ds.rda
Binary file not shown.
Binary file removed data/admiral_lb.rda
Binary file not shown.
Binary file removed data/admiral_mh.rda
Binary file not shown.
Binary file removed data/admiral_pc.rda
Binary file not shown.
Binary file removed data/admiral_pp.rda
Binary file not shown.
Binary file removed data/admiral_qs.rda
Binary file not shown.
Binary file removed data/admiral_rs.rda
Binary file not shown.
Binary file removed data/admiral_sc.rda
Binary file not shown.
Binary file removed data/admiral_sdg_db.rda
Binary file not shown.
Binary file removed data/admiral_smq_db.rda
Binary file not shown.
Binary file removed data/admiral_suppds.rda
Binary file not shown.
Binary file removed data/admiral_supptr.rda
Binary file not shown.
Binary file removed data/admiral_tr.rda
Binary file not shown.
Binary file removed data/admiral_tu.rda
Binary file not shown.
Binary file added data/ae.rda
Binary file not shown.
Binary file added data/cm.rda
Binary file not shown.
Binary file added data/dm.rda
Binary file not shown.
Binary file added data/ds.rda
Binary file not shown.
Binary file added data/ex.rda
Binary file not shown.
Binary file modified data/ex_ophtha.rda
Binary file not shown.
Binary file added data/lb.rda
Binary file not shown.
Binary file added data/mh.rda
Binary file not shown.
Binary file renamed data/admiral_oe.rda → data/oe_ophtha.rda
Binary file not shown.
Binary file added data/pc.rda
Binary file not shown.
Binary file added data/pp.rda
Binary file not shown.
Binary file added data/qs.rda
Binary file not shown.
Binary file modified data/qs_ophtha.rda
Binary file not shown.
Binary file added data/rs_onco.rda
Binary file not shown.
Binary file added data/sc_ophtha.rda
Binary file not shown.
Binary file added data/sdg_db.rda
Binary file not shown.
Binary file added data/smq_db.rda
Binary file not shown.
Binary file added data/suppae.rda
Binary file not shown.
Binary file added data/suppdm.rda
Binary file not shown.
Binary file added data/suppds.rda
Binary file not shown.
Binary file added data/supptr_onco.rda
Binary file not shown.
Binary file added data/sv.rda
Binary file not shown.
Binary file added data/tr_onco.rda
Binary file not shown.
Binary file added data/ts.rda
Binary file not shown.
Binary file added data/tu_onco.rda
Binary file not shown.
Binary file added data/vs.rda
Binary file not shown.

0 comments on commit fd772f3

Please sign in to comment.