Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hi Ben, #63

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Loading