diff --git a/data-raw/forestly_adae.R b/data-raw/forestly_adae.R new file mode 100644 index 0000000..28c511d --- /dev/null +++ b/data-raw/forestly_adae.R @@ -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") + diff --git a/data-raw/forestly_adae.rda b/data-raw/forestly_adae.rda new file mode 100644 index 0000000..279c41f Binary files /dev/null and b/data-raw/forestly_adae.rda differ diff --git a/data-raw/forestly_adsl.R b/data-raw/forestly_adsl.R new file mode 100644 index 0000000..ce03231 --- /dev/null +++ b/data-raw/forestly_adsl.R @@ -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") diff --git a/data-raw/forestly_adsl.rda b/data-raw/forestly_adsl.rda new file mode 100644 index 0000000..1b89e7f Binary files /dev/null and b/data-raw/forestly_adsl.rda differ