Skip to content

Commit

Permalink
#33 recist: fix variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
bundfussr committed Aug 29, 2023
1 parent 228a48c commit 9e988fd
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions data-raw/rs_onco_recist.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ tu <- tu_onco_recist
tr <- derive_vars_merged(
tr_onco_recist,
dataset_add = tu,
by_vars = exprs(USUBJID, TREVAL = TUEVAL, TREVALID = TUEVALID, TRLINKID = TULINKID),
by_vars = exprs(USUBJID, TREVAL = TUEVAL, TREVALID = TUEVALID, TRLNKID = TULNKID),
new_vars = exprs(TRLOC = TULOC)
)

Expand Down Expand Up @@ -38,8 +38,8 @@ sums <- tr %>%
summarise(
TRSTRESN = sum(TRSTRESN),
CRFL = all(CRFL),
IDS = paste(sort(TRLINKID), collapse = ", "),
NTFL = all(substr(TRLINKID, 1, 1) == "N")
IDS = paste(sort(TRLNKID), collapse = ", "),
NTFL = all(substr(TRLNKID, 1, 1) == "N")
) %>%
mutate(TRTESTCD = "SUMDIAM") %>%
ungroup()
Expand Down
14 changes: 7 additions & 7 deletions data-raw/tr_onco_recist.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ library(admiral)

# create tumor results to be used for RS
tr <- tribble(
~SUBJNR, ~TRLINKID, ~TRTESTCD, ~TRORRES, ~VISITNUM,
~SUBJNR, ~TRLNKID, ~TRTESTCD, ~TRORRES, ~VISITNUM,
# BOR = CR, CBOR = SD
"1", "T01", "LDIAM", "21", 1,
"1", "T02", "LPERP", "32", 1,
Expand Down Expand Up @@ -120,7 +120,7 @@ tr <- tribble(
suppress_warning(
tr_compl <- tr %>%
mutate(
diff_percent = (as.numeric(SUBJNR) + as.numeric(substr(TRLINKID, 3, 3)) + VISITNUM) %% 11,
diff_percent = (as.numeric(SUBJNR) + as.numeric(substr(TRLNKID, 3, 3)) + VISITNUM) %% 11,
TRORRES = case_match(
TRTESTCD,
"LDIAM" ~ as.character(as.numeric(TRORRES) * (1 - diff_percent / 100)),
Expand All @@ -144,7 +144,7 @@ tr <- bind_rows(tr, tr_compl)
suppress_warning(
tr_radio1 <- tr %>%
mutate(
diff_percent = (as.numeric(SUBJNR) + as.numeric(substr(TRLINKID, 3, 3)) + VISITNUM) %% 7 - 3,
diff_percent = (as.numeric(SUBJNR) + as.numeric(substr(TRLNKID, 3, 3)) + VISITNUM) %% 7 - 3,
TRORRES = if_else(
TRTESTCD %in% c("LDIAM", "LPERP"),
as.character(as.numeric(TRORRES) * (1 + diff_percent / 100)),
Expand All @@ -159,7 +159,7 @@ suppress_warning(
suppress_warning(
tr_radio2 <- tr %>%
mutate(
diff_percent = (as.numeric(SUBJNR) + as.numeric(substr(TRLINKID, 3, 3)) + VISITNUM + 3) %% 7 - 3,
diff_percent = (as.numeric(SUBJNR) + as.numeric(substr(TRLNKID, 3, 3)) + VISITNUM + 3) %% 7 - 3,
TRORRES = if_else(
TRTESTCD %in% c("LDIAM", "LPERP"),
as.character(as.numeric(TRORRES) * (1 + diff_percent / 100)),
Expand All @@ -174,11 +174,11 @@ tr <- bind_rows(tr, tr_radio1, tr_radio2) %>%
select(-diff_percent) %>%
mutate(
TRGRPID = if_else(
substr(TRLINKID, 1, 1) == "T",
substr(TRLNKID, 1, 1) == "T",
"TARGET",
"NON-TARGET"
),
.before = TRLINKID
.before = TRLNKID
) %>%
mutate(
TREVAL = if_else(is.na(TREVALID), "INVESTIGATOR", "INDEPENDENT ASSESSOR"),
Expand Down Expand Up @@ -273,7 +273,7 @@ tr <- derive_var_obs_number(

tr_screen <- tr %>%
filter(VISITNUM == 1 & basicfl == "Y") %>%
select(STUDYID, USUBJID, SUBJNR, TRLINKID, TRTESTCD, VISIT, VISITNUM, TREVAL, TREVALID, TRACPTFL)
select(STUDYID, USUBJID, SUBJNR, TRLNKID, TRTESTCD, VISIT, VISITNUM, TREVAL, TREVALID, TRACPTFL)
saveRDS(tr_screen, file = "data-raw/tu_help_data.rds")

tr_onco_recist <- select(tr, -SUBJNR, -basicfl, -RFSTDT)
Expand Down
6 changes: 3 additions & 3 deletions data-raw/tu_onco_recist.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ tu <- tr_screen %>%
TULOC = if_else(
TRTESTCD == "LPERP",
"LYMPH NODE",
locations[as.numeric(SUBJNR) + as.numeric(substr(TRLINKID, str_length(TRLINKID), str_length(TRLINKID)))]
locations[as.numeric(SUBJNR) + as.numeric(substr(TRLNKID, str_length(TRLNKID), str_length(TRLNKID)))]
),
TUTESTCD = "TUMIDENT",
TUTEST = "Tumore Identification"
Expand All @@ -33,10 +33,10 @@ tu_onco_recist <- tu %>%
.before = STUDYID
) %>%
mutate(
TUORRES = if_else(substr(TRLINKID, 1, 1) == "T", "TARGET", "NON-TARGET"),
TUORRES = if_else(substr(TRLNKID, 1, 1) == "T", "TARGET", "NON-TARGET"),
TUSTRESC = TUORRES,
TUMETHOD = "CT SCAN",
TULINKID = TRLINKID,
TULNKID = TRLNKID,
TUEVAL = TREVAL,
TUEVALID = TREVALID,
TUACPTFL = TRACPTFL
Expand Down
Binary file modified data/tr_onco_recist.rda
Binary file not shown.
Binary file modified data/tu_onco_recist.rda
Binary file not shown.
2 changes: 1 addition & 1 deletion man/tr_onco_recist.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9e988fd

Please sign in to comment.