Skip to content

Commit

Permalink
Hi Ben,
Browse files Browse the repository at this point in the history
ADSL and ADAE dataset are compared and no issue found. I have derived 2 new variable in ADAE which are AREL and TRTA and 1 new variable in ADSL which is TRTA.
Thanks,
Jeetender
  • Loading branch information
jeetendersinghc committed Dec 3, 2024
1 parent fbf486d commit 5d8d980
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 0 deletions.
43 changes: 43 additions & 0 deletions data-raw/forestly_adae.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

library(arsenal)
library(stringr)



adae <- r2rtf::r2rtf_adae


load("~/forestly/data/forestly_adae_3grp.rda")


# Derive AREL from existing AEREL
adae <- adae %>%
mutate(AREL = case_when(
AEREL %in% c("PROBABLE", "POSSIBLE") ~ "RELATED",
AEREL %in% c("NONE", "REMOTE", "") ~ "NOT RELATED",
TRUE ~ AEREL # Keep original AREL if none of the conditions are met
),
TRTA = str_replace_all(as.character(TRTA), "Xanomeline ", "") %>% as.factor() # Remove "Xanomeline " and convert to factor
)

freq <- adae %>% count(AREL, AEREL) %>%
arrange(desc(n))
print(freq)

str(adae$TRTA)
str(forestly_adae_3grp$TRTA)

# Define the desired order of levels
desired_levels <- c("Placebo", "Low Dose", "High Dose")

# Standardize TRTA in adae
adae$TRTA <- factor(adae$TRTA, levels = desired_levels)

source("~/forestly/R/function_dataset0compare.R")

# Call the function to compare the datasets and save the summary
comparison_result <- compare_datasets(adae, forestly_adae_3grp, "compareresult_adae.html")

# Save the adae dataset as an .rda file
save(adae, file = "~/forestly/data-raw/forestly_adae.rda")

Binary file added data-raw/forestly_adae.rda
Binary file not shown.
38 changes: 38 additions & 0 deletions data-raw/forestly_adsl.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

library(arsenal)
library(stringr)


adsl <- r2rtf::r2rtf_adsl




load("~/forestly/data/forestly_adsl_3grp.rda")



source("~/forestly/R/function_dataset0compare.R")


#Compare ADSL dataset

freq <- forestly_adsl_3grp %>% count(TRT01A, TRTA) %>%
arrange(desc(n))
print(freq)

# Derive TRTA from existing AEREL
adsl <- adsl %>%
mutate(
TRTA = str_replace_all(as.character(TRT01A), "Xanomeline ", "") %>% as.factor() # Remove "Xanomeline " and convert to factor
)

# Define the desired order of levels
desired_levels <- c("Placebo", "Low Dose", "High Dose")

# Standardize TRTA in adae
adsl$TRTA <- factor(adsl$TRTA, levels = desired_levels)


# Save the adae dataset as an .rda file
save(adsl, file = "~/forestly/data-raw/forestly_adsl.rda")
Binary file added data-raw/forestly_adsl.rda
Binary file not shown.

0 comments on commit 5d8d980

Please sign in to comment.