Subjects With Treatment-emergent Adverse Events Leading to Permanent Discontinuation of Study Treatment by System Organ Class, Preferred Term, and Subgroup
# Program Name: tsfae04a.R# Prep Environmentlibrary(envsetup)library(tern)library(dplyr)library(rtables)library(junco)# Define script level parameters:# - Define output ID and file locationtblid <-"TSFAE04a"fileid <- tblidtab_titles <-get_titles_from_file(input_path ='../../_data/', tblid)string_map <- default_str_maptrtvar <-"TRT01A"popfl <-"SAFFL"subgrpvar <-"AGEGR1"subgrptxt <-"Age Group"subgrpunit <-"years"combined_colspan_trt <-TRUErisk_diff <-TRUErr_method <-"wald"ctrl_grp <-"Placebo"if (combined_colspan_trt ==TRUE) {# 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 Data:adsl <- pharmaverseadamjnj::adsl %>%filter(!!rlang::sym(popfl) =="Y") %>%mutate(subgrpdisplay =as.factor(paste0( subgrptxt,": ",!!as.name(subgrpvar)," ", subgrpunit )) ) %>%select( STUDYID, USUBJID,all_of(trtvar),all_of(popfl),all_of(subgrpvar), subgrpdisplay )adae <- pharmaverseadamjnj::adae %>%filter(TRTEMFL =="Y"& AEACN =="DRUG WITHDRAWN") %>%select(USUBJID, TRTEMFL, AEBODSYS, AEDECOD)adsl$colspan_trt <-factor(ifelse(adsl[[trtvar]] =="Placebo", " ", "Active Study Agent"),levels =c("Active Study Agent", " "))if (risk_diff ==TRUE) { adsl$rrisk_header <-"Risk Difference (%) (95% CI)" adsl$rrisk_label <-paste(adsl[[trtvar]], paste("vs", ctrl_grp))}# join data togetherae <-left_join(adsl, adae, by =c("USUBJID"))colspan_trt_map <-create_colspan_map( adsl,non_active_grp = ctrl_grp,non_active_grp_span_lbl =" ",active_grp_span_lbl ="Active Study Agent",colspan_var ="colspan_trt",trt_var = trtvar)# Define layout and build table:ref_path <-c("colspan_trt", " ", "TRT01A", "Placebo")extra_args_rr <-list(denom ="n_altdf",denom_by ="subgrpdisplay",riskdiff =FALSE,extrablankline =TRUE,.stats =c("n_altdf"))extra_args_rr2 <-list(denom ="n_altdf",denom_by ="subgrpdisplay",riskdiff =TRUE,ref_path = ref_path,method ="wald",.stats =c("count_unique_fraction"))lyt <-basic_table(top_level_section_div =" ",show_colcounts =TRUE,colcount_format ="N=xx") %>%split_cols_by("colspan_trt",split_fun =trim_levels_to_map(map = colspan_trt_map) )if (combined_colspan_trt ==TRUE) { lyt <- lyt %>%split_cols_by(trtvar, split_fun = mysplit)} else { lyt <- lyt %>%split_cols_by(trtvar)}if (risk_diff ==TRUE) { lyt <- lyt %>%split_cols_by("rrisk_header", nested =FALSE) %>%split_cols_by( trtvar,labels_var ="rrisk_label",split_fun =remove_split_levels("Placebo") )}lyt <- lyt %>%split_rows_by("subgrpdisplay",split_label ="",split_fun =trim_levels_in_group("STUDYID"),indent_mod =-1L,section_div =c(" "),page_by =TRUE ) %>%# Set page_by = FALSE if you do not wish to start a new page after a new subgroupsummarize_row_groups("subgrpdisplay",cfun = a_freq_j,indent_mod =0L,extra_args = extra_args_rr ) %>%split_rows_by("TRTEMFL",split_fun =keep_split_levels("Y"),indent_mod =-1L,section_div =c(" ") ) %>%summarize_row_groups("TRTEMFL",cfun = a_freq_j,indent_mod =0L,extra_args =append( extra_args_rr2,list(label ="Subjects with >=1 AE leading to discontinuation",extrablankline =TRUE ) ) ) %>%split_rows_by("AEBODSYS",split_label ="System Organ Class",split_fun =trim_levels_in_group("AEDECOD"),label_pos ="topleft",indent_mod =0L,section_div =c(" ") ) %>%summarize_row_groups("AEBODSYS",cfun = a_freq_j,extra_args = extra_args_rr2 ) %>%analyze("AEDECOD", afun = a_freq_j, extra_args = extra_args_rr2) %>%append_topleft(" Preferred Term, n (%)")result <-build_table(lyt, ae, alt_counts_df = adsl)## Remove the N=xx column headers for the risk difference columnsresult <-remove_col_count(result)# Post-Processing step to sort by descending count on chosen active treatment columns.if (length(adae$TRTEMFL) !=0) { result <-sort_at_path( result,c("subgrpdisplay", "*", "TRTEMFL", "*", "AEBODSYS"),scorefun =jj_complex_scorefun() ) result <-sort_at_path( result,c("subgrpdisplay", "*", "TRTEMFL", "*", "AEBODSYS", "*", "AEDECOD"),scorefun =jj_complex_scorefun() )}# Add titles and footnotes:result <-set_titles(result, tab_titles)# Convert to tbl file and output tablett_to_tlgrtf(string_map = string_map, tt = result, file = fileid, orientation ="landscape")
TSFAE04a:Subjects With Treatment-emergent Adverse Events Leading to Permanent Discontinuation of Study Treatment by System Organ Class, Preferred Term, and [Subgroup]; Safety Analysis Set (Study jjcs - core)
Active Study Agent
Risk Difference (%) (95% CI)
System Organ Class
Xanomeline High Dose
Xanomeline Low Dose
Combined
Placebo
Xanomeline High Dose vs Placebo
Xanomeline Low Dose vs Placebo
Preferred Term, n (%)
N=53
N=73
N=126
N=59
Age Group: ≥18 to <65 years
8
5
13
7
Subjects with ≥1 AE leading to discontinuation
6 (75.0%)
0
6 (46.2%)
1 (14.3%)
60.7 (21.1, 100.0)
-14.3 (-40.2, 11.6)
General disorders and administration site conditions
2 (25.0%)
0
2 (15.4%)
0
25.0 (-5.0, 55.0)
0.0 (0.0, 0.0)
APPLICATION SITE PRURITUS
2 (25.0%)
0
2 (15.4%)
0
25.0 (-5.0, 55.0)
0.0 (0.0, 0.0)
Skin and subcutaneous tissue disorders
2 (25.0%)
0
2 (15.4%)
1 (14.3%)
10.7 (-28.9, 50.4)
-14.3 (-40.2, 11.6)
ERYTHEMA
1 (12.5%)
0
1 (7.7%)
0
12.5 (-10.4, 35.4)
0.0 (0.0, 0.0)
PRURITUS
1 (12.5%)
0
1 (7.7%)
0
12.5 (-10.4, 35.4)
0.0 (0.0, 0.0)
DRUG ERUPTION
0
0
0
1 (14.3%)
-14.3 (-40.2, 11.6)
-14.3 (-40.2, 11.6)
Gastrointestinal disorders
1 (12.5%)
0
1 (7.7%)
0
12.5 (-10.4, 35.4)
0.0 (0.0, 0.0)
SALIVARY HYPERSECRETION
1 (12.5%)
0
1 (7.7%)
0
12.5 (-10.4, 35.4)
0.0 (0.0, 0.0)
Infections and infestations
1 (12.5%)
0
1 (7.7%)
0
12.5 (-10.4, 35.4)
0.0 (0.0, 0.0)
UPPER RESPIRATORY TRACT INFECTION
1 (12.5%)
0
1 (7.7%)
0
12.5 (-10.4, 35.4)
0.0 (0.0, 0.0)
Nervous system disorders
1 (12.5%)
0
1 (7.7%)
0
12.5 (-10.4, 35.4)
0.0 (0.0, 0.0)
HEADACHE
1 (12.5%)
0
1 (7.7%)
0
12.5 (-10.4, 35.4)
0.0 (0.0, 0.0)
Psychiatric disorders
1 (12.5%)
0
1 (7.7%)
0
12.5 (-10.4, 35.4)
0.0 (0.0, 0.0)
LISTLESS
1 (12.5%)
0
1 (7.7%)
0
12.5 (-10.4, 35.4)
0.0 (0.0, 0.0)
Respiratory, thoracic and mediastinal disorders
1 (12.5%)
0
1 (7.7%)
0
12.5 (-10.4, 35.4)
0.0 (0.0, 0.0)
RESPIRATORY TRACT CONGESTION
1 (12.5%)
0
1 (7.7%)
0
12.5 (-10.4, 35.4)
0.0 (0.0, 0.0)
Age Group: ≥65 to <75 years
16
17
33
19
Subjects with ≥1 AE leading to discontinuation
7 (43.8%)
3 (17.6%)
10 (30.3%)
6 (31.6%)
12.2 (-19.9, 44.2)
-13.9 (-41.6, 13.7)
General disorders and administration site conditions
2 (12.5%)
1 (5.9%)
3 (9.1%)
1 (5.3%)
7.2 (-11.8, 26.3)
0.6 (-14.4, 15.6)
APPLICATION SITE IRRITATION
1 (6.2%)
0
1 (3.0%)
0
6.2 (-5.6, 18.1)
0.0 (0.0, 0.0)
APPLICATION SITE PRURITUS
0
1 (5.9%)
1 (3.0%)
0
0.0 (0.0, 0.0)
5.9 (-5.3, 17.1)
FATIGUE
1 (6.2%)
0
1 (3.0%)
0
6.2 (-5.6, 18.1)
0.0 (0.0, 0.0)
APPLICATION SITE ERYTHEMA
0
0
0
1 (5.3%)
-5.3 (-15.3, 4.8)
-5.3 (-15.3, 4.8)
Skin and subcutaneous tissue disorders
3 (18.8%)
0
3 (9.1%)
1 (5.3%)
13.5 (-8.1, 35.1)
-5.3 (-15.3, 4.8)
ERYTHEMA
1 (6.2%)
0
1 (3.0%)
0
6.2 (-5.6, 18.1)
0.0 (0.0, 0.0)
PRURITUS
1 (6.2%)
0
1 (3.0%)
0
6.2 (-5.6, 18.1)
0.0 (0.0, 0.0)
RASH
1 (6.2%)
0
1 (3.0%)
1 (5.3%)
1.0 (-14.6, 16.5)
-5.3 (-15.3, 4.8)
SKIN IRRITATION
1 (6.2%)
0
1 (3.0%)
0
6.2 (-5.6, 18.1)
0.0 (0.0, 0.0)
Respiratory, thoracic and mediastinal disorders
1 (6.2%)
1 (5.9%)
2 (6.1%)
1 (5.3%)
1.0 (-14.6, 16.5)
0.6 (-14.4, 15.6)
ALLERGIC GRANULOMATOUS ANGIITIS
1 (6.2%)
0
1 (3.0%)
0
6.2 (-5.6, 18.1)
0.0 (0.0, 0.0)
DYSPHONIA
0
1 (5.9%)
1 (3.0%)
0
0.0 (0.0, 0.0)
5.9 (-5.3, 17.1)
NASAL CONGESTION
1 (6.2%)
0
1 (3.0%)
0
6.2 (-5.6, 18.1)
0.0 (0.0, 0.0)
POSTNASAL DRIP
0
0
0
1 (5.3%)
-5.3 (-15.3, 4.8)
-5.3 (-15.3, 4.8)
Gastrointestinal disorders
0
1 (5.9%)
1 (3.0%)
0
0.0 (0.0, 0.0)
5.9 (-5.3, 17.1)
DIARRHOEA
0
1 (5.9%)
1 (3.0%)
0
0.0 (0.0, 0.0)
5.9 (-5.3, 17.1)
VOMITING
0
1 (5.9%)
1 (3.0%)
0
0.0 (0.0, 0.0)
5.9 (-5.3, 17.1)
Investigations
0
1 (5.9%)
1 (3.0%)
2 (10.5%)
-10.5 (-24.3, 3.3)
-4.6 (-22.4, 13.1)
WEIGHT DECREASED
0
1 (5.9%)
1 (3.0%)
0
0.0 (0.0, 0.0)
5.9 (-5.3, 17.1)
BLOOD CREATINE PHOSPHOKINASE INCREASED
0
0
0
1 (5.3%)
-5.3 (-15.3, 4.8)
-5.3 (-15.3, 4.8)
ELECTROCARDIOGRAM T WAVE AMPLITUDE DECREASED
0
0
0
1 (5.3%)
-5.3 (-15.3, 4.8)
-5.3 (-15.3, 4.8)
Vascular disorders
1 (6.2%)
0
1 (3.0%)
0
6.2 (-5.6, 18.1)
0.0 (0.0, 0.0)
WOUND HAEMORRHAGE
1 (6.2%)
0
1 (3.0%)
0
6.2 (-5.6, 18.1)
0.0 (0.0, 0.0)
Metabolism and nutrition disorders
0
0
0
1 (5.3%)
-5.3 (-15.3, 4.8)
-5.3 (-15.3, 4.8)
DECREASED APPETITE
0
0
0
1 (5.3%)
-5.3 (-15.3, 4.8)
-5.3 (-15.3, 4.8)
Musculoskeletal and connective tissue disorders
0
0
0
1 (5.3%)
-5.3 (-15.3, 4.8)
-5.3 (-15.3, 4.8)
SHOULDER PAIN
0
0
0
1 (5.3%)
-5.3 (-15.3, 4.8)
-5.3 (-15.3, 4.8)
Nervous system disorders
0
0
0
1 (5.3%)
-5.3 (-15.3, 4.8)
-5.3 (-15.3, 4.8)
PARKINSON'S DISEASE
0
0
0
1 (5.3%)
-5.3 (-15.3, 4.8)
-5.3 (-15.3, 4.8)
Psychiatric disorders
0
0
0
1 (5.3%)
-5.3 (-15.3, 4.8)
-5.3 (-15.3, 4.8)
DISORIENTATION
0
0
0
1 (5.3%)
-5.3 (-15.3, 4.8)
-5.3 (-15.3, 4.8)
Age Group: ≥75 years
29
51
80
33
Subjects with ≥1 AE leading to discontinuation
10 (34.5%)
17 (33.3%)
27 (33.8%)
11 (33.3%)
1.1 (-22.5, 24.8)
0.0 (-20.6, 20.6)
General disorders and administration site conditions
2 (6.9%)
7 (13.7%)
9 (11.2%)
3 (9.1%)
-2.2 (-15.7, 11.3)
4.6 (-9.0, 18.3)
APPLICATION SITE IRRITATION
0
3 (5.9%)
3 (3.8%)
0
0.0 (0.0, 0.0)
5.9 (-0.6, 12.3)
APPLICATION SITE PRURITUS
0
3 (5.9%)
3 (3.8%)
0
0.0 (0.0, 0.0)
5.9 (-0.6, 12.3)
APPLICATION SITE DERMATITIS
1 (3.4%)
0
1 (1.2%)
1 (3.0%)
0.4 (-8.4, 9.3)
-3.0 (-8.9, 2.8)
APPLICATION SITE ERYTHEMA
0
1 (2.0%)
1 (1.2%)
0
0.0 (0.0, 0.0)
2.0 (-1.8, 5.8)
ASTHENIA
0
1 (2.0%)
1 (1.2%)
0
0.0 (0.0, 0.0)
2.0 (-1.8, 5.8)
CHEST PAIN
1 (3.4%)
0
1 (1.2%)
0
3.4 (-3.2, 10.1)
0.0 (0.0, 0.0)
ULCER
0
1 (2.0%)
1 (1.2%)
0
0.0 (0.0, 0.0)
2.0 (-1.8, 5.8)
APPLICATION SITE INDURATION
0
0
0
1 (3.0%)
-3.0 (-8.9, 2.8)
-3.0 (-8.9, 2.8)
APPLICATION SITE REACTION
0
0
0
1 (3.0%)
-3.0 (-8.9, 2.8)
-3.0 (-8.9, 2.8)
OEDEMA PERIPHERAL
0
0
0
1 (3.0%)
-3.0 (-8.9, 2.8)
-3.0 (-8.9, 2.8)
Nervous system disorders
3 (10.3%)
4 (7.8%)
7 (8.8%)
0
10.3 (-0.7, 21.4)
7.8 (0.5, 15.2)
DIZZINESS
1 (3.4%)
3 (5.9%)
4 (5.0%)
0
3.4 (-3.2, 10.1)
5.9 (-0.6, 12.3)
SYNCOPE
1 (3.4%)
1 (2.0%)
2 (2.5%)
0
3.4 (-3.2, 10.1)
2.0 (-1.8, 5.8)
HEADACHE
1 (3.4%)
0
1 (1.2%)
0
3.4 (-3.2, 10.1)
0.0 (0.0, 0.0)
Skin and subcutaneous tissue disorders
2 (6.9%)
3 (5.9%)
5 (6.2%)
3 (9.1%)
-2.2 (-15.7, 11.3)
-3.2 (-15.0, 8.5)
BLISTER
0
1 (2.0%)
1 (1.2%)
0
0.0 (0.0, 0.0)
2.0 (-1.8, 5.8)
PRURITUS
0
1 (2.0%)
1 (1.2%)
0
0.0 (0.0, 0.0)
2.0 (-1.8, 5.8)
RASH
1 (3.4%)
0
1 (1.2%)
0
3.4 (-3.2, 10.1)
0.0 (0.0, 0.0)
RASH PRURITIC
1 (3.4%)
0
1 (1.2%)
0
3.4 (-3.2, 10.1)
0.0 (0.0, 0.0)
SKIN IRRITATION
0
1 (2.0%)
1 (1.2%)
1 (3.0%)
-3.0 (-8.9, 2.8)
-1.1 (-8.0, 5.9)
ERYTHEMA
0
0
0
1 (3.0%)
-3.0 (-8.9, 2.8)
-3.0 (-8.9, 2.8)
HYPERHIDROSIS
0
0
0
1 (3.0%)
-3.0 (-8.9, 2.8)
-3.0 (-8.9, 2.8)
Cardiac disorders
1 (3.4%)
1 (2.0%)
2 (2.5%)
0
3.4 (-3.2, 10.1)
2.0 (-1.8, 5.8)
MYOCARDIAL INFARCTION
1 (3.4%)
0
1 (1.2%)
0
3.4 (-3.2, 10.1)
0.0 (0.0, 0.0)
PALPITATIONS
0
1 (2.0%)
1 (1.2%)
0
0.0 (0.0, 0.0)
2.0 (-1.8, 5.8)
Infections and infestations
1 (3.4%)
1 (2.0%)
2 (2.5%)
5 (15.2%)
-11.7 (-25.6, 2.2)
-13.2 (-26.0, -0.4)
NASOPHARYNGITIS
1 (3.4%)
1 (2.0%)
2 (2.5%)
1 (3.0%)
0.4 (-8.4, 9.3)
-1.1 (-8.0, 5.9)
LOCALISED INFECTION
0
0
0
1 (3.0%)
-3.0 (-8.9, 2.8)
-3.0 (-8.9, 2.8)
UPPER RESPIRATORY TRACT INFECTION
0
0
0
2 (6.1%)
-6.1 (-14.2, 2.1)
-6.1 (-14.2, 2.1)
URINARY TRACT INFECTION
0
0
0
1 (3.0%)
-3.0 (-8.9, 2.8)
-3.0 (-8.9, 2.8)
Injury, poisoning and procedural complications
1 (3.4%)
1 (2.0%)
2 (2.5%)
0
3.4 (-3.2, 10.1)
2.0 (-1.8, 5.8)
CONTUSION
1 (3.4%)
1 (2.0%)
2 (2.5%)
0
3.4 (-3.2, 10.1)
2.0 (-1.8, 5.8)
Gastrointestinal disorders
0
1 (2.0%)
1 (1.2%)
2 (6.1%)
-6.1 (-14.2, 2.1)
-4.1 (-13.1, 4.9)
DIARRHOEA
0
1 (2.0%)
1 (1.2%)
1 (3.0%)
-3.0 (-8.9, 2.8)
-1.1 (-8.0, 5.9)
HIATUS HERNIA
0
0
0
1 (3.0%)
-3.0 (-8.9, 2.8)
-3.0 (-8.9, 2.8)
Psychiatric disorders
1 (3.4%)
0
1 (1.2%)
0
3.4 (-3.2, 10.1)
0.0 (0.0, 0.0)
DELIRIUM
1 (3.4%)
0
1 (1.2%)
0
3.4 (-3.2, 10.1)
0.0 (0.0, 0.0)
Renal and urinary disorders
0
1 (2.0%)
1 (1.2%)
0
0.0 (0.0, 0.0)
2.0 (-1.8, 5.8)
INCONTINENCE
0
1 (2.0%)
1 (1.2%)
0
0.0 (0.0, 0.0)
2.0 (-1.8, 5.8)
Respiratory, thoracic and mediastinal disorders
0
1 (2.0%)
1 (1.2%)
0
0.0 (0.0, 0.0)
2.0 (-1.8, 5.8)
DYSPNOEA
0
1 (2.0%)
1 (1.2%)
0
0.0 (0.0, 0.0)
2.0 (-1.8, 5.8)
Eye disorders
0
0
0
1 (3.0%)
-3.0 (-8.9, 2.8)
-3.0 (-8.9, 2.8)
EYE PRURITUS
0
0
0
1 (3.0%)
-3.0 (-8.9, 2.8)
-3.0 (-8.9, 2.8)
Investigations
0
0
0
1 (3.0%)
-3.0 (-8.9, 2.8)
-3.0 (-8.9, 2.8)
CYSTOSCOPY
0
0
0
1 (3.0%)
-3.0 (-8.9, 2.8)
-3.0 (-8.9, 2.8)
Surgical and medical procedures
0
0
0
1 (3.0%)
-3.0 (-8.9, 2.8)
-3.0 (-8.9, 2.8)
CATARACT OPERATION
0
0
0
1 (3.0%)
-3.0 (-8.9, 2.8)
-3.0 (-8.9, 2.8)
Note: 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.