TL Catalog
  1. Tables
  2. Adverse Events
  3. TSFAE24F
  • Introduction

  • Index

  • Tables
    • Adverse Events
      • TSFAE01A
      • TSFAE01B
      • TSFAE02
      • TSFAE02A
      • TSFAE03
      • TSFAE03A
      • TSFAE04
      • TSFAE04A
      • TSFAE05
      • TSFAE05A
      • TSFAE06A
      • TSFAE06B
      • TSFAE07A
      • TSFAE07B
      • TSFAE08
      • TSFAE09
      • TSFAE10
      • TSFAE11
      • TSFAE12
      • TSFAE13
      • TSFAE14
      • TSFAE15
      • TSFAE16
      • TSFAE17A
      • TSFAE17B
      • TSFAE17C
      • TSFAE17D
      • TSFAE19A
      • TSFAE19B
      • TSFAE19C
      • TSFAE19D
      • TSFAE20A
      • TSFAE20B
      • TSFAE20C
      • TSFAE21A
      • TSFAE21B
      • TSFAE21C
      • TSFAE21D
      • TSFAE22A
      • TSFAE22B
      • TSFAE22C
      • TSFAE23A
      • TSFAE23B
      • TSFAE23C
      • TSFAE23D
      • TSFAE24A
      • TSFAE24B
      • TSFAE24C
      • TSFAE24D
      • TSFAE24F
      • TSFDTH01
    • Clinical Laboratory Evaluation
      • TSFLAB01
      • TSFLAB01A
      • TSFLAB02
      • TSFLAB02A
      • TSFLAB02B
      • TSFLAB03
      • TSFLAB03A
      • TSFLAB04A
      • TSFLAB04B
      • TSFLAB05
      • TSFLAB06
      • TSFLAB07
    • Demographic
      • TSIDEM01
      • TSIDEM02
      • TSIMH01
    • Disposition of Subjects
      • TSIDS01
      • TSIDS02
      • TSIDS02A
    • Electrocardiograms
      • TSFECG01
      • TSFECG01A
      • TSFECG02
      • TSFECG03
      • TSFECG04
      • TSFECG05
    • Exposure
      • TSIEX01
      • TSIEX02
      • TSIEX03
      • TSIEX04
      • TSIEX06
      • TSIEX07
      • TSIEX08
      • TSIEX09
      • TSIEX10
      • TSIEX11
    • Pharmacokinetics
      • TPK01A
      • TPK01B
      • TPK02
      • TPK03
    • Prior and Concomitant Therapies
      • TSICM01
      • TSICM02
      • TSICM03
      • TSICM04
      • TSICM05
      • TSICM06
      • TSICM07
      • TSICM08
    • Vital Signs and Physical Findings
      • TSFVIT01
      • TSFVIT01A
      • TSFVIT02
      • TSFVIT03
      • TSFVIT04
      • TSFVIT05
      • TSFVIT06
  • Listings
    • Adverse Events
      • LSFAE01
      • LSFAE02
      • LSFAE03
      • LSFAE04
      • LSFAE05
      • LSFAE06A
      • LSFAE06B
      • LSFDTH01
    • Clinical Laboratory Evaluation
      • LSFLAB01
    • Demographic
      • LSIDEM01
      • LSIDEM02
      • LSIMH01
    • Disposition of Subjects
      • LSIDS01
      • LSIDS02
      • LSIDS03
      • LSIDS04
      • LSIDS05
    • Electrocardiograms
      • LSFECG01
      • LSFECG02
    • Exposure
      • LSIEX01
      • LSIEX02
      • LSIEX03
    • Prior and Concomitant Therapies
      • LSICM01
    • Vital Signs and Physical Findings
      • LSFVIT01
      • LSFVIT02

  • Reproducibility

  • Changelog

On this page

  • Output
  • Edit this page
  • Report an issue
  1. Tables
  2. Adverse Events
  3. TSFAE24F

TSFAE24F

Subjects With Treatment-emergent Adverse Events With Frequency =x% in Any Treatment Group by System Organ Class and Preferred Term and Onset Time


Output

  • Preview
Code
# Program Name:              tsfae24f.R

# Prep environment:

library(envsetup)
library(tern)
library(forcats)
library(dplyr)
library(rtables)
library(junco)

# Define script level parameters:

tblid <- "TSFAE24f"
fileid <- tblid
popfl <- "SAFFL"
trtvar <- "TRT01A"
tab_titles <- get_titles_from_file(input_path = '../../_data/', tblid)
string_map <- default_str_map

# Process data:

adsl <- pharmaverseadamjnj::adsl %>%
  filter(!!rlang::sym(popfl) == "Y") %>%
  create_colspan_var(
    non_active_grp = "Placebo",
    non_active_grp_span_lbl = " ",
    active_grp_span_lbl = "Active Study Agent",
    colspan_var = "colspan_trt",
    trt_var = trtvar
  ) %>%
  mutate(
    months = (TRTEDY + 30) / 30.4375,
    ACAT1 = case_when(
      months <= 3 ~ "Within 3 months",
      months > 3 & months <= 6 ~ "4 to 6 months",
      months > 6 & months <= 9 ~ "7 to 9 months",
      months > 9 & months <= 12 ~ "10 to 12 months",
      months > 12 ~ "Beyond 13 months",
      .default = NA_character_
    ),
    ACAT1 = factor(
      ACAT1,
      levels = c(
        "Within 3 months",
        "4 to 6 months",
        "7 to 9 months",
        "10 to 12 months",
        "Beyond 13 months"
      )
    )
  ) %>%
  select(
    USUBJID,
    !!rlang::sym(popfl),
    !!rlang::sym(trtvar),
    colspan_trt,
    TRTEDY,
    ACAT1
  )

adae <- pharmaverseadamjnj::adae %>%
  filter(TRTEMFL == "Y") %>%
  select(
    USUBJID,
    TRTEMFL,
    AEBODSYS,
    AEDECOD,
    ASTDT,
    ACAT1,
    AOCCFL,
    AOCCPFL,
    AOCCSFL
  ) %>%
  mutate(
    ACAT1 = forcats::fct_na_value_to_level(factor(
      ACAT1,
      levels = c(
        "Within 3 months",
        "4 to 6 months",
        "7 to 9 months",
        "10 to 12 months",
        "Beyond 13 months"
      )
    ))
  ) %>%
  arrange(USUBJID, AEBODSYS, AEDECOD, ASTDT)

adae <- inner_join(adae, adsl %>% select(-ACAT1), by = c("USUBJID"))

adae$TRTEMFL <- factor(adae$TRTEMFL)

# Define layout and build table:

colspan_trt_map <- create_colspan_map(
  adsl,
  non_active_grp = "Placebo",
  non_active_grp_span_lbl = " ",
  active_grp_span_lbl = "Active Study Agent",
  colspan_var = "colspan_trt",
  trt_var = trtvar
)

# This df generates facets with cumulative counts for .N_col. Note: These extra
# records must then be removed from the numerator by a_freq_combos_j function.
combodf <- tribble(
  ~valname         , ~label             , ~levelcombo                                                                                                , ~exargs ,
  "Total"          , "Total"            , c("Within 3 months", "4 to 6 months", "7 to 9 months", "10 to 12 months", "Beyond 13 months", "(Missing)") , list()  ,
  "Thru 3 months"  , "Within 3 months"  , c("Within 3 months", "4 to 6 months", "7 to 9 months", "10 to 12 months", "Beyond 13 months")              , list()  ,
  "Thru 6 months"  , "4 to 6 months"    , c("4 to 6 months", "7 to 9 months", "10 to 12 months", "Beyond 13 months")                                 , list()  ,
  "Thru 9 months"  , "7 to 9 months"    , c("7 to 9 months", "10 to 12 months", "Beyond 13 months")                                                  , list()  ,
  "Thru 12 months" , "10 to 12 months"  , c("10 to 12 months", "Beyond 13 months")                                                                   , list()  ,
  "Over 13 months" , "Beyond 13 months" , c("Beyond 13 months")                                                                                      , list()
)


extra_args1 <- list(
  combosdf = combodf,
  filter_var = "ACAT1",
  do_not_filter = "Total",
  .stats = "count_unique_fraction"
)

lyt <- basic_table(top_level_section_div = " ") %>%
  split_cols_by(
    "colspan_trt",
    split_fun = trim_levels_to_map(map = colspan_trt_map)
  ) %>%
  split_cols_by(trtvar) %>%
  split_cols_by(
    "ACAT1",
    split_fun = add_combo_levels(
      combosdf = combodf,
      trim = FALSE,
      keep_levels = combodf$valname
    )
  ) %>%
  analyze(
    popfl,
    show_labels = "hidden",
    afun = a_freq_j,
    extra_args = list(
      label = "Analysis set: Safety",
      .stats = "n_altdf"
    )
  ) %>%
  analyze(
    "TRTEMFL",
    nested = FALSE,
    show_labels = "hidden",
    afun = a_freq_combos_j,
    extra_args = append(
      extra_args1,
      list(
        val = "Y",
        label = "Subjects with >= 1 AE",
        flag_var = NULL
      )
    )
  ) %>%
  split_rows_by(
    "AEBODSYS",
    split_label = "System Organ Class",
    label_pos = "topleft",
    split_fun = trim_levels_in_group("AEDECOD"),
    section_div = c(" ")
  ) %>%
  summarize_row_groups(
    "AEBODSYS",
    cfun = a_freq_combos_j,
    extra_args = append(
      extra_args1,
      list(flag_var = NULL)
    )
  ) %>%
  analyze(
    "AEDECOD",
    afun = a_freq_combos_j,
    extra_args = append(
      extra_args1,
      list(flag_var = NULL)
    )
  ) %>%
  append_topleft("  Preferred Term, n (%)")

result <- build_table(lyt, adae, alt_counts_df = adsl)

# Prune & sort results

result <- safe_prune_table(result, prune_func = bspt_pruner())

result <- result %>%
  sort_at_path(
    path = c("root", "AEBODSYS"),
    scorefun = jj_complex_scorefun(colpath = "Total")
  ) %>%
  sort_at_path(
    path = c("root", "AEBODSYS", "*", "AEDECOD"),
    scorefun = jj_complex_scorefun(colpath = "Total")
  )

# Add titles and footnotes:

result <- set_titles(result, tab_titles)

# Convert to tbl file and output table:

tt_to_tlgrtf(string_map = string_map, tt = 
  result,
  file = fileid,
  orientation = "landscape",
  nosplitin = list(cols = c(trtvar))
)

TSFAE24f: Subjects With [Treatment-emergent Adverse Events] With Frequency =[x]% in [Any Treatment Group] by System Organ Class and Preferred Term and Onset Time; Safety Analysis Set (Study jjcs - core)

Active Study Agent

System Organ Class

Xanomeline High Dose

Xanomeline Low Dose

Placebo

Preferred Term, n (%)

Total

Within 3 months

4 to 6 months

7 to 9 months

10 to 12 months

Beyond 13 months

Total

Within 3 months

4 to 6 months

7 to 9 months

10 to 12 months

Beyond 13 months

Total

Within 3 months

4 to 6 months

7 to 9 months

10 to 12 months

Beyond 13 months

Analysis set: Safety

53

53

49

38

30

14

73

73

55

39

24

12

59

59

44

34

22

8

Subjects with ≥ 1 AE

51 (96.2%)

4 (7.5%)

11 (22.4%)

7 (18.4%)

15 (50.0%)

14 (100.0%)

62 (84.9%)

14 (19.2%)

15 (27.3%)

14 (35.9%)

10 (41.7%)

9 (75.0%)

42 (71.2%)

11 (18.6%)

6 (13.6%)

9 (26.5%)

13 (59.1%)

3 (37.5%)

Skin and subcutaneous tissue
 disorders

34 (64.2%)

4 (7.5%)

5 (10.2%)

6 (15.8%)

10 (33.3%)

9 (64.3%)

28 (38.4%)

8 (11.0%)

7 (12.7%)

2 (5.1%)

6 (25.0%)

5 (41.7%)

16 (27.1%)

5 (8.5%)

3 (6.8%)

4 (11.8%)

3 (13.6%)

1 (12.5%)

PRURITUS

20 (37.7%)

1 (1.9%)

2 (4.1%)

6 (15.8%)

5 (16.7%)

6 (42.9%)

14 (19.2%)

4 (5.5%)

3 (5.5%)

0

4 (16.7%)

3 (25.0%)

6 (10.2%)

1 (1.7%)

2 (4.5%)

2 (5.9%)

1 (4.5%)

0

ERYTHEMA

12 (22.6%)

1 (1.9%)

2 (4.1%)

4 (10.5%)

3 (10.0%)

2 (14.3%)

8 (11.0%)

4 (5.5%)

1 (1.8%)

0

2 (8.3%)

1 (8.3%)

6 (10.2%)

2 (3.4%)

1 (2.3%)

2 (5.9%)

1 (4.5%)

0

HYPERHIDROSIS

8 (15.1%)

1 (1.9%)

1 (2.0%)

0

3 (10.0%)

3 (21.4%)

4 (5.5%)

1 (1.4%)

2 (3.6%)

1 (2.6%)

0

0

2 (3.4%)

0

1 (2.3%)

0

1 (4.5%)

0

RASH

5 (9.4%)

1 (1.9%)

0

1 (2.6%)

2 (6.7%)

1 (7.1%)

9 (12.3%)

2 (2.7%)

3 (5.5%)

0

3 (12.5%)

1 (8.3%)

4 (6.8%)

1 (1.7%)

0

2 (5.9%)

0

1 (12.5%)

SKIN IRRITATION

4 (7.5%)

1 (1.9%)

1 (2.0%)

0

1 (3.3%)

1 (7.1%)

4 (5.5%)

2 (2.7%)

1 (1.8%)

0

0

1 (8.3%)

3 (5.1%)

1 (1.7%)

0

2 (5.9%)

0

0

RASH PRURITIC

2 (3.8%)

1 (1.9%)

0

0

0

1 (7.1%)

1 (1.4%)

0

0

1 (2.6%)

0

0

0

0

0

0

0

0

BLISTER

1 (1.9%)

0

0

0

1 (3.3%)

0

2 (2.7%)

0

0

0

1 (4.2%)

1 (8.3%)

0

0

0

0

0

0

PRURITUS GENERALISED

1 (1.9%)

0

0

0

0

1 (7.1%)

0

0

0

0

0

0

0

0

0

0

0

0

SKIN ODOUR ABNORMAL

1 (1.9%)

0

0

0

0

1 (7.1%)

0

0

0

0

0

0

0

0

0

0

0

0

RASH ERYTHEMATOUS

0

0

0

0

0

0

1 (1.4%)

0

0

0

0

1 (8.3%)

0

0

0

0

0

0

General disorders and
 administration site conditions

26 (49.1%)

1 (1.9%)

7 (14.3%)

2 (5.3%)

8 (26.7%)

8 (57.1%)

38 (52.1%)

10 (13.7%)

11 (20.0%)

6 (15.4%)

5 (20.8%)

6 (50.0%)

16 (27.1%)

3 (5.1%)

2 (4.5%)

4 (11.8%)

6 (27.3%)

1 (12.5%)

APPLICATION SITE PRURITUS

13 (24.5%)

1 (1.9%)

5 (10.2%)

1 (2.6%)

3 (10.0%)

3 (21.4%)

18 (24.7%)

6 (8.2%)

5 (9.1%)

3 (7.7%)

1 (4.2%)

3 (25.0%)

4 (6.8%)

2 (3.4%)

0

1 (2.9%)

1 (4.5%)

0

APPLICATION SITE ERYTHEMA

10 (18.9%)

0

4 (8.2%)

2 (5.3%)

1 (3.3%)

3 (21.4%)

11 (15.1%)

5 (6.8%)

2 (3.6%)

1 (2.6%)

1 (4.2%)

2 (16.7%)

2 (3.4%)

0

0

1 (2.9%)

1 (4.5%)

0

APPLICATION SITE IRRITATION

8 (15.1%)

0

2 (4.1%)

0

1 (3.3%)

5 (35.7%)

7 (9.6%)

1 (1.4%)

3 (5.5%)

0

1 (4.2%)

2 (16.7%)

2 (3.4%)

1 (1.7%)

0

0

1 (4.5%)

0

FATIGUE

5 (9.4%)

0

0

0

2 (6.7%)

3 (21.4%)

5 (6.8%)

3 (4.1%)

0

0

1 (4.2%)

1 (8.3%)

0

0

0

0

0

0

APPLICATION SITE DERMATITIS

4 (7.5%)

1 (1.9%)

1 (2.0%)

0

2 (6.7%)

0

7 (9.6%)

0

2 (3.6%)

3 (7.7%)

0

2 (16.7%)

5 (8.5%)

1 (1.7%)

0

2 (5.9%)

1 (4.5%)

1 (12.5%)

APPLICATION SITE VESICLES

4 (7.5%)

0

1 (2.0%)

0

1 (3.3%)

2 (14.3%)

4 (5.5%)

1 (1.4%)

2 (3.6%)

1 (2.6%)

0

0

0

0

0

0

0

0

APPLICATION SITE PAIN

2 (3.8%)

0

0

0

0

2 (14.3%)

0

0

0

0

0

0

0

0

0

0

0

0

APPLICATION SITE
 PERSPIRATION

2 (3.8%)

0

1 (2.0%)

0

0

1 (7.1%)

0

0

0

0

0

0

0

0

0

0

0

0

CHEST PAIN

2 (3.8%)

0

0

0

1 (3.3%)

1 (7.1%)

0

0

0

0

0

0

0

0

0

0

0

0

MALAISE

2 (3.8%)

0

0

0

1 (3.3%)

1 (7.1%)

1 (1.4%)

0

0

0

1 (4.2%)

0

0

0

0

0

0

0

APPLICATION SITE REACTION

1 (1.9%)

0

0

0

0

1 (7.1%)

0

0

0

0

0

0

1 (1.7%)

1 (1.7%)

0

0

0

0

CHEST DISCOMFORT

1 (1.9%)

0

0

0

0

1 (7.1%)

1 (1.4%)

0

0

1 (2.6%)

0

0

0

0

0

0

0

0

FEELING ABNORMAL

1 (1.9%)

0

0

0

0

1 (7.1%)

0

0

0

0

0

0

0

0

0

0

0

0

OEDEMA PERIPHERAL

1 (1.9%)

0

1 (2.0%)

0

0

0

1 (1.4%)

0

1 (1.8%)

0

0

0

2 (3.4%)

0

0

0

2 (9.1%)

0

PAIN

1 (1.9%)

0

0

0

0

1 (7.1%)

0

0

0

0

0

0

0

0

0

0

0

0

ASTHENIA

0

0

0

0

0

0

1 (1.4%)

0

0

0

0

1 (8.3%)

1 (1.7%)

0

1 (2.3%)

0

0

0

Nervous system disorders

18 (34.0%)

0

4 (8.2%)

2 (5.3%)

8 (26.7%)

4 (28.6%)

18 (24.7%)

2 (2.7%)

6 (10.9%)

5 (12.8%)

3 (12.5%)

2 (16.7%)

5 (8.5%)

1 (1.7%)

1 (2.3%)

0

2 (9.1%)

1 (12.5%)

DIZZINESS

8 (15.1%)

0

2 (4.1%)

1 (2.6%)

4 (13.3%)

1 (7.1%)

8 (11.0%)

1 (1.4%)

2 (3.6%)

1 (2.6%)

2 (8.3%)

2 (16.7%)

0

0

0

0

0

0

HEADACHE

5 (9.4%)

0

1 (2.0%)

1 (2.6%)

1 (3.3%)

2 (14.3%)

3 (4.1%)

0

0

1 (2.6%)

0

2 (16.7%)

2 (3.4%)

0

0

0

1 (4.5%)

1 (12.5%)

COGNITIVE DISORDER

1 (1.9%)

0

0

0

0

1 (7.1%)

0

0

0

0

0

0

0

0

0

0

0

0

PARTIAL SEIZURES WITH
 SECONDARY
 GENERALISATION

1 (1.9%)

0

0

0

0

1 (7.1%)

0

0

0

0

0

0

0

0

0

0

0

0

SYNCOPE

1 (1.9%)

0

0

0

1 (3.3%)

0

3 (4.1%)

0

1 (1.8%)

2 (5.1%)

0

0

0

0

0

0

0

0

TRANSIENT ISCHAEMIC ATTACK

1 (1.9%)

0

0

0

1 (3.3%)

0

2 (2.7%)

0

1 (1.8%)

0

0

1 (8.3%)

0

0

0

0

0

0

STUPOR

0

0

0

0

0

0

1 (1.4%)

0

0

0

0

1 (8.3%)

0

0

0

0

0

0

Gastrointestinal disorders

14 (26.4%)

0

6 (12.2%)

0

5 (16.7%)

3 (21.4%)

10 (13.7%)

2 (2.7%)

2 (3.6%)

3 (7.7%)

2 (8.3%)

1 (8.3%)

7 (11.9%)

2 (3.4%)

2 (4.5%)

0

2 (9.1%)

1 (12.5%)

NAUSEA

5 (9.4%)

0

3 (6.1%)

0

0

2 (14.3%)

2 (2.7%)

0

1 (1.8%)

0

1 (4.2%)

0

0

0

0

0

0

0

VOMITING

5 (9.4%)

0

3 (6.1%)

0

2 (6.7%)

0

2 (2.7%)

0

0

2 (5.1%)

0

0

0

0

0

0

0

0

SALIVARY HYPERSECRETION

4 (7.5%)

0

3 (6.1%)

0

1 (3.3%)

0

0

0

0

0

0

0

0

0

0

0

0

0

DIARRHOEA

2 (3.8%)

0

0

0

2 (6.7%)

0

3 (4.1%)

0

1 (1.8%)

2 (5.1%)

0

0

3 (5.1%)

1 (1.7%)

1 (2.3%)

0

1 (4.5%)

0

STOMACH DISCOMFORT

1 (1.9%)

0

0

0

0

1 (7.1%)

0

0

0

0

0

0

0

0

0

0

0

0

GLOSSITIS

0

0

0

0

0

0

0

0

0

0

0

0

1 (1.7%)

0

0

0

0

1 (12.5%)

RECTAL HAEMORRHAGE

0

0

0

0

0

0

1 (1.4%)

0

0

0

0

1 (8.3%)

0

0

0

0

0

0

Cardiac disorders

11 (20.8%)

0

2 (4.1%)

1 (2.6%)

6 (20.0%)

2 (14.3%)

11 (15.1%)

1 (1.4%)

1 (1.8%)

6 (15.4%)

1 (4.2%)

2 (16.7%)

7 (11.9%)

4 (6.8%)

0

1 (2.9%)

1 (4.5%)

1 (12.5%)

SINUS BRADYCARDIA

7 (13.2%)

0

1 (2.0%)

0

5 (16.7%)

1 (7.1%)

4 (5.5%)

1 (1.4%)

1 (1.8%)

1 (2.6%)

1 (4.2%)

0

0

0

0

0

0

0

MYOCARDIAL INFARCTION

3 (5.7%)

0

2 (4.1%)

1 (2.6%)

0

0

1 (1.4%)

0

0

0

0

1 (8.3%)

3 (5.1%)

1 (1.7%)

0

0

1 (4.5%)

1 (12.5%)

ATRIAL FIBRILLATION

1 (1.9%)

0

0

0

1 (3.3%)

0

2 (2.7%)

0

0

1 (2.6%)

0

1 (8.3%)

0

0

0

0

0

0

VENTRICULAR EXTRASYSTOLES

1 (1.9%)

0

0

0

0

1 (7.1%)

2 (2.7%)

0

0

2 (5.1%)

0

0

0

0

0

0

0

0

ATRIOVENTRICULAR BLOCK
 FIRST DEGREE

0

0

0

0

0

0

1 (1.4%)

0

0

0

0

1 (8.3%)

0

0

0

0

0

0

PALPITATIONS

0

0

0

0

0

0

2 (2.7%)

0

0

2 (5.1%)

0

0

0

0

0

0

0

0

SUPRAVENTRICULAR
 TACHYCARDIA

0

0

0

0

0

0

1 (1.4%)

0

0

0

0

1 (8.3%)

0

0

0

0

0

0

TACHYCARDIA

0

0

0

0

0

0

0

0

0

0

0

0

1 (1.7%)

0

0

0

0

1 (12.5%)

Infections and infestations

9 (17.0%)

1 (1.9%)

1 (2.0%)

1 (2.6%)

4 (13.3%)

2 (14.3%)

6 (8.2%)

3 (4.1%)

0

3 (7.7%)

0

0

14 (23.7%)

3 (5.1%)

3 (6.8%)

1 (2.9%)

5 (22.7%)

2 (25.0%)

NASOPHARYNGITIS

3 (5.7%)

1 (1.9%)

0

0

2 (6.7%)

0

3 (4.1%)

1 (1.4%)

0

2 (5.1%)

0

0

2 (3.4%)

0

0

1 (2.9%)

1 (4.5%)

0

UPPER RESPIRATORY TRACT
 INFECTION

2 (3.8%)

0

0

0

1 (3.3%)

1 (7.1%)

0

0

0

0

0

0

5 (8.5%)

2 (3.4%)

0

0

2 (9.1%)

1 (12.5%)

HORDEOLUM

1 (1.9%)

0

0

0

0

1 (7.1%)

0

0

0

0

0

0

0

0

0

0

0

0

RHINITIS

1 (1.9%)

0

0

0

0

1 (7.1%)

0

0

0

0

0

0

0

0

0

0

0

0

EAR INFECTION

0

0

0

0

0

0

0

0

0

0

0

0

2 (3.4%)

0

1 (2.3%)

0

0

1 (12.5%)

Respiratory, thoracic and
 mediastinal disorders

7 (13.2%)

0

3 (6.1%)

0

2 (6.7%)

2 (14.3%)

6 (8.2%)

3 (4.1%)

0

2 (5.1%)

0

1 (8.3%)

5 (8.5%)

0

1 (2.3%)

4 (11.8%)

0

0

COUGH

3 (5.7%)

0

1 (2.0%)

0

1 (3.3%)

1 (7.1%)

4 (5.5%)

1 (1.4%)

0

2 (5.1%)

0

1 (8.3%)

1 (1.7%)

0

0

1 (2.9%)

0

0

NASAL CONGESTION

3 (5.7%)

0

1 (2.0%)

0

1 (3.3%)

1 (7.1%)

0

0

0

0

0

0

2 (3.4%)

0

1 (2.3%)

1 (2.9%)

0

0

EPISTAXIS

2 (3.8%)

0

1 (2.0%)

0

0

1 (7.1%)

0

0

0

0

0

0

0

0

0

0

0

0

PHARYNGOLARYNGEAL PAIN

1 (1.9%)

0

0

0

0

1 (7.1%)

0

0

0

0

0

0

0

0

0

0

0

0

PRODUCTIVE COUGH

1 (1.9%)

0

0

0

0

1 (7.1%)

0

0

0

0

0

0

0

0

0

0

0

0

RESPIRATORY TRACT
 CONGESTION

1 (1.9%)

0

0

0

0

1 (7.1%)

0

0

0

0

0

0

0

0

0

0

0

0

Psychiatric disorders

6 (11.3%)

0

0

0

1 (3.3%)

5 (35.7%)

8 (11.0%)

4 (5.5%)

2 (3.6%)

2 (5.1%)

0

0

7 (11.9%)

1 (1.7%)

2 (4.5%)

2 (5.9%)

2 (9.1%)

0

CONFUSIONAL STATE

1 (1.9%)

0

0

0

0

1 (7.1%)

3 (4.1%)

1 (1.4%)

1 (1.8%)

1 (2.6%)

0

0

2 (3.4%)

1 (1.7%)

1 (2.3%)

0

0

0

DELIRIUM

1 (1.9%)

0

0

0

0

1 (7.1%)

0

0

0

0

0

0

0

0

0

0

0

0

DELUSION

1 (1.9%)

0

0

0

0

1 (7.1%)

0

0

0

0

0

0

1 (1.7%)

0

1 (2.3%)

0

0

0

HALLUCINATION

1 (1.9%)

0

0

0

0

1 (7.1%)

0

0

0

0

0

0

0

0

0

0

0

0

HALLUCINATION, VISUAL

1 (1.9%)

0

0

0

0

1 (7.1%)

0

0

0

0

0

0

0

0

0

0

0

0

INSOMNIA

1 (1.9%)

0

0

0

0

1 (7.1%)

0

0

0

0

0

0

1 (1.7%)

0

0

1 (2.9%)

0

0

LIBIDO DECREASED

1 (1.9%)

0

0

0

0

1 (7.1%)

0

0

0

0

0

0

0

0

0

0

0

0

LISTLESS

1 (1.9%)

0

0

0

0

1 (7.1%)

0

0

0

0

0

0

0

0

0

0

0

0

Investigations

5 (9.4%)

1 (1.9%)

0

1 (2.6%)

1 (3.3%)

2 (14.3%)

7 (9.6%)

1 (1.4%)

1 (1.8%)

3 (7.7%)

0

2 (16.7%)

7 (11.9%)

2 (3.4%)

1 (2.3%)

1 (2.9%)

3 (13.6%)

0

BLOOD GLUCOSE INCREASED

1 (1.9%)

0

0

0

0

1 (7.1%)

1 (1.4%)

0

0

1 (2.6%)

0

0

0

0

0

0

0

0

ELECTROCARDIOGRAM T WAVE
 INVERSION

1 (1.9%)

0

0

0

0

1 (7.1%)

1 (1.4%)

0

0

0

0

1 (8.3%)

2 (3.4%)

1 (1.7%)

1 (2.3%)

0

0

0

ELECTROCARDIOGRAM ST
 SEGMENT DEPRESSION

0

0

0

0

0

0

1 (1.4%)

0

0

1 (2.6%)

0

0

3 (5.1%)

1 (1.7%)

0

0

2 (9.1%)

0

ELECTROCARDIOGRAM T WAVE
 AMPLITUDE DECREASED

0

0

0

0

0

0

1 (1.4%)

0

0

0

0

1 (8.3%)

1 (1.7%)

0

1 (2.3%)

0

0

0

Musculoskeletal and connective
 tissue disorders

4 (7.5%)

0

1 (2.0%)

0

1 (3.3%)

2 (14.3%)

5 (6.8%)

3 (4.1%)

0

2 (5.1%)

0

0

2 (3.4%)

1 (1.7%)

0

1 (2.9%)

0

0

BACK PAIN

2 (3.8%)

0

0

0

1 (3.3%)

1 (7.1%)

1 (1.4%)

1 (1.4%)

0

0

0

0

1 (1.7%)

1 (1.7%)

0

0

0

0

MYALGIA

1 (1.9%)

0

0

0

0

1 (7.1%)

0

0

0

0

0

0

0

0

0

0

0

0

Injury, poisoning and
 procedural complications

3 (5.7%)

0

0

0

2 (6.7%)

1 (7.1%)

5 (6.8%)

3 (4.1%)

1 (1.8%)

1 (2.6%)

0

0

2 (3.4%)

0

1 (2.3%)

1 (2.9%)

0

0

CONTUSION

2 (3.8%)

0

0

0

1 (3.3%)

1 (7.1%)

1 (1.4%)

0

1 (1.8%)

0

0

0

0

0

0

0

0

0

Eye disorders

1 (1.9%)

0

0

1 (2.6%)

0

0

2 (2.7%)

0

0

1 (2.6%)

0

1 (8.3%)

2 (3.4%)

0

1 (2.3%)

1 (2.9%)

0

0

VISION BLURRED

1 (1.9%)

0

0

1 (2.6%)

0

0

1 (1.4%)

0

0

0

0

1 (8.3%)

0

0

0

0

0

0

Metabolism and nutrition
 disorders

1 (1.9%)

0

0

0

0

1 (7.1%)

0

0

0

0

0

0

2 (3.4%)

0

0

0

2 (9.1%)

0

INCREASED APPETITE

1 (1.9%)

0

0

0

0

1 (7.1%)

0

0

0

0

0

0

0

0

0

0

0

0

Neoplasms benign, malignant
 and unspecified (incl cysts
 and polyps)

1 (1.9%)

0

0

0

0

1 (7.1%)

1 (1.4%)

0

0

0

1 (4.2%)

0

0

0

0

0

0

0

PROSTATE CANCER

1 (1.9%)

0

0

0

0

1 (7.1%)

0

0

0

0

0

0

0

0

0

0

0

0

Vascular disorders

1 (1.9%)

1 (1.9%)

0

0

0

0

3 (4.1%)

1 (1.4%)

1 (1.8%)

1 (2.6%)

0

0

3 (5.1%)

1 (1.7%)

0

0

1 (4.5%)

1 (12.5%)

HYPOTENSION

0

0

0

0

0

0

1 (1.4%)

1 (1.4%)

0

0

0

0

2 (3.4%)

0

0

0

1 (4.5%)

1 (12.5%)

Note: Subjects are counted only once for any given event within a time category, regardless of the number of times they actually experienced the event. The event experienced by the subject with the first onset relative to [the start of [study treatment]] is summarized. If a subject has all adverse events with missing onset date, the subject is only counted in the total column. Percentages are calculated using the number of subjects at each time category as the denominator.

Note: Adverse events are coded using MedDRA version 26.0.

Download RTF file

TSFAE24D
TSFDTH01
Source Code
---
title: TSFAE24F
subtitle: Subjects With Treatment-emergent Adverse Events With Frequency =x% in Any Treatment Group by System Organ Class and Preferred Term and Onset Time
---

------------------------------------------------------------------------

{{< include ../../_utils/envir_hook.qmd >}}

```{r setup, echo = FALSE, warning = FALSE, message = FALSE}
options(docx.add_datetime = FALSE, tidytlg.add_datetime = FALSE)
envsetup_config_name <- "default"

# Path to the combined config file
envsetup_file_path <- file.path("../..", "envsetup.yml")

Sys.setenv(ENVSETUP_ENVIRON = '')
library(envsetup)
loaded_config <- config::get(config = envsetup_config_name, file = envsetup_file_path)
envsetup::rprofile(loaded_config)


dpscomp <- compound
dpspdr <- paste(protocol,dbrelease,rpteff,sep="__")

aptcomp <- compound
aptpdr <- paste(protocol,dbrelease,rpteff,sep="__")

###### Study specific updates (formerly in envre)

dpscomp <- "standards"
dpspdr <- "jjcs__NULL__jjcs - core"

apt <- FALSE
library(junco)
default_str_map <- rbind(default_str_map, c("&ctcae", "5.0"))

```

## Output

:::: panel-tabset
## {{< fa regular file-lines sm fw >}} Preview

```{r variant1, results='hide', warning = FALSE, message = FALSE}

# Program Name:              tsfae24f.R

# Prep environment:

library(envsetup)
library(tern)
library(forcats)
library(dplyr)
library(rtables)
library(junco)

# Define script level parameters:

tblid <- "TSFAE24f"
fileid <- tblid
popfl <- "SAFFL"
trtvar <- "TRT01A"
tab_titles <- get_titles_from_file(input_path = '../../_data/', tblid)
string_map <- default_str_map

# Process data:

adsl <- pharmaverseadamjnj::adsl %>%
  filter(!!rlang::sym(popfl) == "Y") %>%
  create_colspan_var(
    non_active_grp = "Placebo",
    non_active_grp_span_lbl = " ",
    active_grp_span_lbl = "Active Study Agent",
    colspan_var = "colspan_trt",
    trt_var = trtvar
  ) %>%
  mutate(
    months = (TRTEDY + 30) / 30.4375,
    ACAT1 = case_when(
      months <= 3 ~ "Within 3 months",
      months > 3 & months <= 6 ~ "4 to 6 months",
      months > 6 & months <= 9 ~ "7 to 9 months",
      months > 9 & months <= 12 ~ "10 to 12 months",
      months > 12 ~ "Beyond 13 months",
      .default = NA_character_
    ),
    ACAT1 = factor(
      ACAT1,
      levels = c(
        "Within 3 months",
        "4 to 6 months",
        "7 to 9 months",
        "10 to 12 months",
        "Beyond 13 months"
      )
    )
  ) %>%
  select(
    USUBJID,
    !!rlang::sym(popfl),
    !!rlang::sym(trtvar),
    colspan_trt,
    TRTEDY,
    ACAT1
  )

adae <- pharmaverseadamjnj::adae %>%
  filter(TRTEMFL == "Y") %>%
  select(
    USUBJID,
    TRTEMFL,
    AEBODSYS,
    AEDECOD,
    ASTDT,
    ACAT1,
    AOCCFL,
    AOCCPFL,
    AOCCSFL
  ) %>%
  mutate(
    ACAT1 = forcats::fct_na_value_to_level(factor(
      ACAT1,
      levels = c(
        "Within 3 months",
        "4 to 6 months",
        "7 to 9 months",
        "10 to 12 months",
        "Beyond 13 months"
      )
    ))
  ) %>%
  arrange(USUBJID, AEBODSYS, AEDECOD, ASTDT)

adae <- inner_join(adae, adsl %>% select(-ACAT1), by = c("USUBJID"))

adae$TRTEMFL <- factor(adae$TRTEMFL)

# Define layout and build table:

colspan_trt_map <- create_colspan_map(
  adsl,
  non_active_grp = "Placebo",
  non_active_grp_span_lbl = " ",
  active_grp_span_lbl = "Active Study Agent",
  colspan_var = "colspan_trt",
  trt_var = trtvar
)

# This df generates facets with cumulative counts for .N_col. Note: These extra
# records must then be removed from the numerator by a_freq_combos_j function.
combodf <- tribble(
  ~valname         , ~label             , ~levelcombo                                                                                                , ~exargs ,
  "Total"          , "Total"            , c("Within 3 months", "4 to 6 months", "7 to 9 months", "10 to 12 months", "Beyond 13 months", "(Missing)") , list()  ,
  "Thru 3 months"  , "Within 3 months"  , c("Within 3 months", "4 to 6 months", "7 to 9 months", "10 to 12 months", "Beyond 13 months")              , list()  ,
  "Thru 6 months"  , "4 to 6 months"    , c("4 to 6 months", "7 to 9 months", "10 to 12 months", "Beyond 13 months")                                 , list()  ,
  "Thru 9 months"  , "7 to 9 months"    , c("7 to 9 months", "10 to 12 months", "Beyond 13 months")                                                  , list()  ,
  "Thru 12 months" , "10 to 12 months"  , c("10 to 12 months", "Beyond 13 months")                                                                   , list()  ,
  "Over 13 months" , "Beyond 13 months" , c("Beyond 13 months")                                                                                      , list()
)


extra_args1 <- list(
  combosdf = combodf,
  filter_var = "ACAT1",
  do_not_filter = "Total",
  .stats = "count_unique_fraction"
)

lyt <- basic_table(top_level_section_div = " ") %>%
  split_cols_by(
    "colspan_trt",
    split_fun = trim_levels_to_map(map = colspan_trt_map)
  ) %>%
  split_cols_by(trtvar) %>%
  split_cols_by(
    "ACAT1",
    split_fun = add_combo_levels(
      combosdf = combodf,
      trim = FALSE,
      keep_levels = combodf$valname
    )
  ) %>%
  analyze(
    popfl,
    show_labels = "hidden",
    afun = a_freq_j,
    extra_args = list(
      label = "Analysis set: Safety",
      .stats = "n_altdf"
    )
  ) %>%
  analyze(
    "TRTEMFL",
    nested = FALSE,
    show_labels = "hidden",
    afun = a_freq_combos_j,
    extra_args = append(
      extra_args1,
      list(
        val = "Y",
        label = "Subjects with >= 1 AE",
        flag_var = NULL
      )
    )
  ) %>%
  split_rows_by(
    "AEBODSYS",
    split_label = "System Organ Class",
    label_pos = "topleft",
    split_fun = trim_levels_in_group("AEDECOD"),
    section_div = c(" ")
  ) %>%
  summarize_row_groups(
    "AEBODSYS",
    cfun = a_freq_combos_j,
    extra_args = append(
      extra_args1,
      list(flag_var = NULL)
    )
  ) %>%
  analyze(
    "AEDECOD",
    afun = a_freq_combos_j,
    extra_args = append(
      extra_args1,
      list(flag_var = NULL)
    )
  ) %>%
  append_topleft("  Preferred Term, n (%)")

result <- build_table(lyt, adae, alt_counts_df = adsl)

# Prune & sort results

result <- safe_prune_table(result, prune_func = bspt_pruner())

result <- result %>%
  sort_at_path(
    path = c("root", "AEBODSYS"),
    scorefun = jj_complex_scorefun(colpath = "Total")
  ) %>%
  sort_at_path(
    path = c("root", "AEBODSYS", "*", "AEDECOD"),
    scorefun = jj_complex_scorefun(colpath = "Total")
  )

# Add titles and footnotes:

result <- set_titles(result, tab_titles)

# Convert to tbl file and output table:

tt_to_tlgrtf(string_map = string_map, tt = 
  result,
  file = fileid,
  orientation = "landscape",
  nosplitin = list(cols = c(trtvar))
)
```
```{r result1, echo=FALSE, message=FALSE, warning=FALSE, test = list(result_v1 = "result")}
tt_to_flextable_j(result, tblid, string_map = string_map) 
```

[Download RTF file](`r paste0(tolower(tblid), '.rtf')`)
::::

Made with ❤️ by the J&J Team

  • Edit this page
  • Report an issue
Cookie Preferences