Skip to content

Commit 5d8d980

Browse files
Hi Ben,
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
1 parent fbf486d commit 5d8d980

File tree

4 files changed

+81
-0
lines changed

4 files changed

+81
-0
lines changed

data-raw/forestly_adae.R

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
2+
library(arsenal)
3+
library(stringr)
4+
5+
6+
7+
adae <- r2rtf::r2rtf_adae
8+
9+
10+
load("~/forestly/data/forestly_adae_3grp.rda")
11+
12+
13+
# Derive AREL from existing AEREL
14+
adae <- adae %>%
15+
mutate(AREL = case_when(
16+
AEREL %in% c("PROBABLE", "POSSIBLE") ~ "RELATED",
17+
AEREL %in% c("NONE", "REMOTE", "") ~ "NOT RELATED",
18+
TRUE ~ AEREL # Keep original AREL if none of the conditions are met
19+
),
20+
TRTA = str_replace_all(as.character(TRTA), "Xanomeline ", "") %>% as.factor() # Remove "Xanomeline " and convert to factor
21+
)
22+
23+
freq <- adae %>% count(AREL, AEREL) %>%
24+
arrange(desc(n))
25+
print(freq)
26+
27+
str(adae$TRTA)
28+
str(forestly_adae_3grp$TRTA)
29+
30+
# Define the desired order of levels
31+
desired_levels <- c("Placebo", "Low Dose", "High Dose")
32+
33+
# Standardize TRTA in adae
34+
adae$TRTA <- factor(adae$TRTA, levels = desired_levels)
35+
36+
source("~/forestly/R/function_dataset0compare.R")
37+
38+
# Call the function to compare the datasets and save the summary
39+
comparison_result <- compare_datasets(adae, forestly_adae_3grp, "compareresult_adae.html")
40+
41+
# Save the adae dataset as an .rda file
42+
save(adae, file = "~/forestly/data-raw/forestly_adae.rda")
43+

data-raw/forestly_adae.rda

796 KB
Binary file not shown.

data-raw/forestly_adsl.R

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
2+
library(arsenal)
3+
library(stringr)
4+
5+
6+
adsl <- r2rtf::r2rtf_adsl
7+
8+
9+
10+
11+
load("~/forestly/data/forestly_adsl_3grp.rda")
12+
13+
14+
15+
source("~/forestly/R/function_dataset0compare.R")
16+
17+
18+
#Compare ADSL dataset
19+
20+
freq <- forestly_adsl_3grp %>% count(TRT01A, TRTA) %>%
21+
arrange(desc(n))
22+
print(freq)
23+
24+
# Derive TRTA from existing AEREL
25+
adsl <- adsl %>%
26+
mutate(
27+
TRTA = str_replace_all(as.character(TRT01A), "Xanomeline ", "") %>% as.factor() # Remove "Xanomeline " and convert to factor
28+
)
29+
30+
# Define the desired order of levels
31+
desired_levels <- c("Placebo", "Low Dose", "High Dose")
32+
33+
# Standardize TRTA in adae
34+
adsl$TRTA <- factor(adsl$TRTA, levels = desired_levels)
35+
36+
37+
# Save the adae dataset as an .rda file
38+
save(adsl, file = "~/forestly/data-raw/forestly_adsl.rda")

data-raw/forestly_adsl.rda

144 KB
Binary file not shown.

0 commit comments

Comments
 (0)