# Program Name: tsfae23d.R# Prep environmentlibrary(envsetup)library(tern)library(dplyr)library(rtables)library(junco)# Define script level parameterstblid <-"TSFAE23d"fileid <- tblidpopfl <-"SAFFL"trtvar <-"TRT01A"aerelvar <-"AEREL"combined_colspan_trt <-TRUEtab_titles <-get_titles_from_file(input_path ='../../_data/', tblid)string_map <- default_str_mapif (combined_colspan_trt ==TRUE) {# If no combined treatment column(s) needed for your study then this next# section of code can be removed# Set up levels and label for the required combined columns add_combo <-add_combo_facet("Combined",label ="Combined",levels =c("Xanomeline High Dose","Xanomeline Low Dose" ) )# choose if any facets need to be removed - e.g remove the combined column# for placebo rm_combo_from_placebo <-cond_rm_facets(facets ="Combined",ancestor_pos =NA,value =" ",split ="colspan_trt" ) mysplit <-make_split_fun(post =list(add_combo, rm_combo_from_placebo))}# Process dataadsl <- pharmaverseadamjnj::adsl %>%filter(!!rlang::sym(popfl) =="Y") %>%create_colspan_var(non_active_grp =c("Placebo"),non_active_grp_span_lbl =" ",active_grp_span_lbl ="Active Study Agent",colspan_var ="colspan_trt",trt_var = trtvar ) %>%select( STUDYID, USUBJID,!!rlang::sym(popfl),!!rlang::sym(trtvar), colspan_trt )trt_map <-create_colspan_map(df = adsl,non_active_grp =c("Placebo"),non_active_grp_span_lbl =" ",active_grp_span_lbl ="Active Study Agent",colspan_var ="colspan_trt",trt_var = trtvar)ref_path <-c("colspan_trt", " ", trtvar, "Placebo")adae0 <- pharmaverseadamjnj::adae %>%filter(!!rlang::sym(popfl) =="Y"&!!rlang::sym(aerelvar) =="RELATED"& TRTEMFL =="Y"& AESER =="N" ) %>%left_join(subset(adsl, select =c("STUDYID", "USUBJID", "colspan_trt")),by =c("STUDYID", "USUBJID") ) %>%select( STUDYID, USUBJID,!!rlang::sym(trtvar),!!rlang::sym(popfl),!!rlang::sym(aerelvar), TRTEMFL, AESER, AEDECOD, colspan_trt )if (nrow(adae0) ==0) { adae <- adae0 %>%select(STUDYID, USUBJID, TRTEMFL, AEDECOD) %>%right_join(adsl, by =c("STUDYID", "USUBJID"))} else { adae <- adae0}# Define layout and build tablelyt <-basic_table(show_colcounts =TRUE,colcount_format ="N=xx",top_level_section_div =" ") %>%split_cols_by("colspan_trt", split_fun =trim_levels_to_map(map = trt_map))if (combined_colspan_trt ==TRUE) { lyt <- lyt %>%split_cols_by(trtvar, split_fun = mysplit)} else { lyt <- lyt %>%split_cols_by(trtvar)}lyt <- lyt %>%analyze(vars ="TRTEMFL",show_labels ="hidden",afun = a_freq_j,extra_args =list(label ="Subjects with >=1 related non-serious AE",.stats =c("count_unique_fraction"),val ="Y" ),section_div =c(" ") )if (nrow(adae0) >0) { lyt <- lyt %>%count_occurrences(vars ="AEDECOD",.stats =c("count_fraction_fixed_dp"),.indent_mods =c(count_fraction =-1L),.formats =c("count_fraction_fixed_dp"= jjcsformat_count_fraction),nested =FALSE ) %>%append_topleft("Preferred Term, n (%)")} else { lyt <- lyt %>%append_topleft("Preferred Term, n (%)")}result <-build_table(lyt, df = adae, alt_counts_df = adsl)# Post-processingif (nrow(adae0) >0) {# Post-Processing step to sort by descending count in the Combined# Xanomeline High Dose column result <-sort_at_path(tt = result,path =c("root", "AEDECOD"),scorefun =jj_complex_scorefun(spanningheadercolvar ="colspan_trt",colpath =NULL ) )}if (nrow(adae0) ==0) {# Post-Processing step to remove 'Subjects with' row result <-safe_prune_table( result,prune_func =remove_rows(removerowtext ="Subjects with >=1 related non-serious AE" ) )}# Retrieve titles and footnotesresult <-set_titles(result, tab_titles)# Convert to tbl file and output tablett_to_tlgrtf(string_map = string_map, tt = result, file = fileid)
TSFAE23d:Subjects With Related Non-serious Treatment-emergent Adverse Events by Preferred Term; Safety Analysis Set (Study jjcs - core)
Active Study Agent
Xanomeline High Dose
Xanomeline Low Dose
Combined
Placebo
Preferred Term, n (%)
N=53
N=73
N=126
N=59
Subjects with ≥1 related non-serious AE
13 (24.5%)
11 (15.1%)
24 (19.0%)
17 (28.8%)
DIZZINESS
4 (7.5%)
1 (1.4%)
5 (4.0%)
0
FATIGUE
1 (1.9%)
2 (2.7%)
3 (2.4%)
0
SINUS BRADYCARDIA
2 (3.8%)
1 (1.4%)
3 (2.4%)
0
CONTUSION
1 (1.9%)
1 (1.4%)
2 (1.6%)
0
HEADACHE
2 (3.8%)
0
2 (1.6%)
0
SOMNOLENCE
1 (1.9%)
1 (1.4%)
2 (1.6%)
0
VOMITING
2 (3.8%)
0
2 (1.6%)
0
ABDOMINAL PAIN
0
1 (1.4%)
1 (0.8%)
0
ASTHENIA
0
1 (1.4%)
1 (0.8%)
0
CHEST PAIN
1 (1.9%)
0
1 (0.8%)
0
CONJUNCTIVAL HAEMORRHAGE
0
1 (1.4%)
1 (0.8%)
0
COUGH
0
1 (1.4%)
1 (0.8%)
1 (1.7%)
EPISTAXIS
1 (1.9%)
0
1 (0.8%)
0
INCREASED APPETITE
1 (1.9%)
0
1 (0.8%)
0
NASAL CONGESTION
1 (1.9%)
0
1 (0.8%)
1 (1.7%)
NAUSEA
1 (1.9%)
0
1 (0.8%)
0
NIGHTMARE
1 (1.9%)
0
1 (0.8%)
0
PALPITATIONS
0
1 (1.4%)
1 (0.8%)
0
RHINORRHOEA
0
1 (1.4%)
1 (0.8%)
0
SKIN ODOUR ABNORMAL
1 (1.9%)
0
1 (0.8%)
0
VENTRICULAR EXTRASYSTOLES
0
1 (1.4%)
1 (0.8%)
0
ALOPECIA
0
0
0
1 (1.7%)
BLEEDING ANOVULATORY
0
0
0
1 (1.7%)
BUNDLE BRANCH BLOCK RIGHT
0
0
0
1 (1.7%)
CERVICITIS
0
0
0
1 (1.7%)
CONJUNCTIVITIS
0
0
0
1 (1.7%)
DIARRHOEA
0
0
0
1 (1.7%)
DISORIENTATION
0
0
0
1 (1.7%)
DISTURBANCE IN SEXUAL AROUSAL
0
0
0
1 (1.7%)
DYSURIA
0
0
0
1 (1.7%)
ELECTROCARDIOGRAM T WAVE INVERSION
0
0
0
2 (3.4%)
GASTROENTERITIS VIRAL
0
0
0
1 (1.7%)
HYPERTENSION
0
0
0
1 (1.7%)
HYPOTENSION
0
0
0
1 (1.7%)
MYOCARDIAL INFARCTION
0
0
0
1 (1.7%)
OEDEMA PERIPHERAL
0
0
0
1 (1.7%)
PSYCHOMOTOR HYPERACTIVITY
0
0
0
1 (1.7%)
RASH
0
0
0
1 (1.7%)
UPPER RESPIRATORY TRACT INFECTION
0
0
0
1 (1.7%)
URINARY TRACT INFECTION
0
0
0
1 (1.7%)
Note: An AE is assessed by the investigator as related. Subjects are counted only once for any given event, regardless of the number of times they actually experienced the event.
Note: Adverse events are coded using MedDRA version 26.0.