TL Catalog
  1. Listings
  2. Demographic
  3. LSIDEM02
  • 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. Listings
  2. Demographic
  3. LSIDEM02

LSIDEM02

Randomization Listing


Output

  • Preview
Code
# Program Name:              lsidem02.R

# Prep environment

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

# Define script level parameters

tblid <- "LSIDEM02"
fileid <- tblid
popfl <- "RANDFL"
key_cols <- c("COL1")
disp_cols <- paste0("COL", 1:9)
concat_sep <- " / "
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")

lsting <- adsl %>%
  mutate(
    COL1 = explicit_na(USUBJID, ""),
    COL2 = explicit_na(REGION1, ""),
    COL3 = explicit_na(COUNTRY_DECODE, ""),
    COL4 = case_when(
      !is.na(RANDDT) & any(names(adsl) == "RANDDTM") & !is.na(RANDDTM) ~
        paste0(
          toupper(format(RANDDT, "%d%b%Y")),
          concat_sep,
          substr(RANDDTM, 12, 16)
        ),
      !is.na(RANDDT) & any(names(adsl) == "RANDDTM") & is.na(RANDDTM) ~
        paste0(toupper(format(RANDDT, "%d%b%Y")), concat_sep, "--:--"),
      !is.na(RANDDT) & !any(names(adsl) == "RANDDTM") ~
        paste0(toupper(format(RANDDT, "%d%b%Y"))),
    ),
    COL5 = explicit_na(RANUM, ""),
    # Optional Column: COL6/STRAT1R
    COL6 = explicit_na(STRAT1R, ""),
    # Optional Column: COL7/STRAT2R
    COL7 = explicit_na(STRAT2R, ""),
    COL8 = explicit_na(TRT01P, ""),
    COL9 = explicit_na(TRT01A, "")
  ) %>%
  arrange(COL1)

lsting <- var_relabel(
  lsting,
  COL1 = "Subject ID",
  COL2 = "Region",
  COL3 = paste("Country", "Territory", sep = concat_sep),
  COL4 = paste("Randomization Date", "Time", sep = concat_sep),
  COL5 = "Randomization Number",
  # Optional Column: COL6/STRAT1R
  COL6 = "Stratification Factor 1",
  # Optional Column: COL7/STRAT2R
  COL7 = "Stratification Factor 2",
  COL8 = "Randomization Treatment Assignment",
  COL9 = "Actual Treatment"
)

# Build listing

result <- rlistings::as_listing(
  df = lsting,
  key_cols = c("COL1"),
  disp_cols = disp_cols
)

# Add titles and footnotes

result <- set_titles(result, tab_titles)

# Output listing

tt_to_tlgrtf(string_map = string_map, tt = head(result, 100), file = fileid, orientation = "landscape")

LSIDEM02: Randomization Listing; Randomized Analysis Set (Study jjcs - core)

Subject ID

Region

Country / Territory

Randomization Date / Time

Randomization Number

Stratification Factor 1

Stratification Factor 2

Randomization Treatment Assignment

Actual Treatment

01-701-1023

NA

United States of America

05AUG2012 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Placebo

Placebo

01-701-1028

NA

United States of America

19JUL2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline High Dose

Xanomeline High Dose

01-701-1033

NA

United States of America

18MAR2014 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline Low Dose

Xanomeline Low Dose

01-701-1034

NA

United States of America

01JUL2014 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline High Dose

Xanomeline High Dose

01-701-1047

NA

United States of America

12FEB2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Placebo

Placebo

01-701-1111

NA

United States of America

07SEP2012 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline Low Dose

Xanomeline Low Dose

01-701-1115

NA

United States of America

30NOV2012 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline Low Dose

Xanomeline Low Dose

01-701-1118

NA

United States of America

12MAR2014 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Placebo

Placebo

01-701-1130

NA

United States of America

15FEB2014 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Placebo

Placebo

01-701-1146

NA

United States of America

20MAY2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline High Dose

Xanomeline High Dose

01-701-1148

NA

United States of America

23AUG2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline High Dose

Xanomeline High Dose

01-701-1181

NA

United States of America

05DEC2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline High Dose

Xanomeline Low Dose

01-701-1188

NA

United States of America

15FEB2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline Low Dose

Xanomeline Low Dose

01-701-1192

NA

United States of America

22JUL2012 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline Low Dose

Xanomeline Low Dose

01-701-1203

NA

United States of America

02FEB2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Placebo

Placebo

01-701-1211

NA

United States of America

15NOV2012 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline Low Dose

Xanomeline Low Dose

01-701-1239

NA

United States of America

11JAN2014 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline High Dose

Xanomeline High Dose

01-701-1275

NA

United States of America

07FEB2014 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline High Dose

Xanomeline High Dose

01-701-1287

NA

United States of America

25JAN2014 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline High Dose

Xanomeline High Dose

01-701-1294

NA

United States of America

24MAR2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline Low Dose

Xanomeline Low Dose

01-701-1302

NA

United States of America

29AUG2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline High Dose

Xanomeline High Dose

01-701-1317

NA

United States of America

22MAY2014 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline Low Dose

Xanomeline Low Dose

01-701-1324

NA

United States of America

02OCT2012 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline Low Dose

Xanomeline Low Dose

01-701-1341

NA

United States of America

05JAN2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline Low Dose

Xanomeline Low Dose

01-701-1345

NA

United States of America

08OCT2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Placebo

Placebo

01-701-1360

NA

United States of America

31JUL2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline High Dose

Xanomeline Low Dose

01-701-1363

NA

United States of America

30MAY2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Placebo

Placebo

01-701-1383

NA

United States of America

04FEB2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline High Dose

Xanomeline High Dose

01-701-1387

NA

United States of America

12MAR2014 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Placebo

Placebo

01-701-1392

NA

United States of America

28OCT2012 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Placebo

Placebo

01-701-1415

NA

United States of America

23SEP2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Placebo

Placebo

01-701-1429

NA

United States of America

19MAR2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline Low Dose

Xanomeline Low Dose

01-701-1440

NA

United States of America

08AUG2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Placebo

Placebo

01-701-1442

NA

United States of America

26OCT2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline Low Dose

Xanomeline Low Dose

01-701-1444

NA

United States of America

05JAN2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline High Dose

Xanomeline High Dose

01-702-1082

NA

United States of America

26JUL2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline Low Dose

Xanomeline Low Dose

01-703-1076

NA

United States of America

25OCT2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline High Dose

Xanomeline High Dose

01-703-1096

NA

United States of America

25JAN2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Placebo

Placebo

01-703-1100

NA

United States of America

13MAR2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Placebo

Placebo

01-703-1119

NA

United States of America

20FEB2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline Low Dose

Xanomeline Low Dose

01-703-1175

NA

United States of America

20DEC2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Placebo

Placebo

01-703-1182

NA

United States of America

17OCT2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline Low Dose

Xanomeline Low Dose

01-703-1197

NA

United States of America

16JUN2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline Low Dose

Xanomeline Low Dose

01-703-1210

NA

United States of America

16MAR2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Placebo

Placebo

01-703-1258

NA

United States of America

20JUL2012 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline High Dose

Xanomeline High Dose

01-703-1279

NA

United States of America

13MAY2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline Low Dose

Xanomeline Low Dose

01-703-1299

NA

United States of America

12SEP2012 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Placebo

Placebo

01-703-1335

NA

United States of America

17MAR2014 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline High Dose

Xanomeline High Dose

01-703-1379

NA

United States of America

22SEP2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline Low Dose

Xanomeline Low Dose

01-703-1403

NA

United States of America

12DEC2012 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline High Dose

Xanomeline Low Dose

01-704-1008

NA

United States of America

13JAN2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline High Dose

Xanomeline High Dose

01-704-1009

NA

United States of America

27AUG2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline Low Dose

Xanomeline Low Dose

01-704-1017

NA

United States of America

06OCT2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline High Dose

Xanomeline High Dose

01-704-1025

NA

United States of America

27SEP2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline Low Dose

Xanomeline Low Dose

01-704-1065

NA

United States of America

24OCT2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline High Dose

Xanomeline High Dose

01-704-1074

NA

United States of America

22JAN2014 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline High Dose

Xanomeline High Dose

01-704-1093

NA

United States of America

15MAR2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline High Dose

Xanomeline High Dose

01-704-1114

NA

United States of America

23JAN2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline Low Dose

Xanomeline Low Dose

01-704-1120

NA

United States of America

02DEC2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline Low Dose

Xanomeline Low Dose

01-704-1127

NA

United States of America

02OCT2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Placebo

Placebo

01-704-1135

NA

United States of America

31OCT2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline Low Dose

Xanomeline Low Dose

01-704-1164

NA

United States of America

19SEP2012 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Placebo

Placebo

01-704-1218

NA

United States of America

19NOV2012 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline Low Dose

Xanomeline Low Dose

01-704-1233

NA

United States of America

21MAR2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Placebo

Placebo

01-704-1260

NA

United States of America

30AUG2012 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Placebo

Placebo

01-704-1266

NA

United States of America

13OCT2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline High Dose

Xanomeline High Dose

01-704-1325

NA

United States of America

23APR2014 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline Low Dose

Xanomeline Low Dose

01-704-1388

NA

United States of America

07DEC2012 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Placebo

Placebo

01-704-1435

NA

United States of America

17NOV2012 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Placebo

Placebo

01-705-1059

NA

United States of America

05AUG2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Placebo

Placebo

01-705-1199

NA

United States of America

16SEP2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline Low Dose

Xanomeline Low Dose

01-705-1280

NA

United States of America

17JAN2014 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline High Dose

Xanomeline High Dose

01-705-1281

NA

United States of America

28NOV2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline High Dose

Xanomeline High Dose

01-705-1282

NA

United States of America

26DEC2012 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Placebo

Placebo

01-705-1292

NA

United States of America

14OCT2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline Low Dose

Xanomeline Low Dose

01-705-1303

NA

United States of America

16DEC2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline High Dose

Xanomeline High Dose

01-705-1310

NA

United States of America

02NOV2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline High Dose

Xanomeline High Dose

01-705-1382

NA

United States of America

13MAY2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline High Dose

Xanomeline Low Dose

01-705-1393

NA

United States of America

07SEP2012 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline Low Dose

Xanomeline Low Dose

01-706-1384

NA

United States of America

15SEP2012 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline Low Dose

Xanomeline Low Dose

01-707-1206

NA

United States of America

28OCT2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Placebo

Placebo

01-708-1019

NA

United States of America

20DEC2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline Low Dose

Xanomeline Low Dose

01-708-1032

NA

United States of America

09FEB2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline Low Dose

Xanomeline Low Dose

01-708-1213

NA

United States of America

09FEB2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline High Dose

Xanomeline Low Dose

01-708-1216

NA

United States of America

24OCT2012 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline High Dose

Xanomeline High Dose

01-708-1236

NA

United States of America

21SEP2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline High Dose

Xanomeline Low Dose

01-708-1272

NA

United States of America

06FEB2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline Low Dose

Xanomeline Low Dose

01-708-1286

NA

United States of America

10SEP2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Placebo

Placebo

01-708-1297

NA

United States of America

25JAN2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline Low Dose

Xanomeline Low Dose

01-708-1316

NA

United States of America

23AUG2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Placebo

Placebo

01-708-1336

NA

United States of America

07DEC2012 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline High Dose

Xanomeline High Dose

01-708-1342

NA

United States of America

29DEC2012 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Placebo

Placebo

01-708-1347

NA

United States of America

20APR2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline High Dose

Xanomeline High Dose

01-708-1348

NA

United States of America

05AUG2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline Low Dose

Xanomeline Low Dose

01-708-1353

NA

United States of America

04JUL2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline Low Dose

Xanomeline Low Dose

01-708-1372

NA

United States of America

12APR2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline High Dose

Xanomeline Low Dose

01-708-1378

NA

United States of America

03SEP2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Placebo

Placebo

01-709-1001

NA

United States of America

08OCT2013 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Placebo

Placebo

01-709-1081

NA

United States of America

18JAN2014 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Xanomeline Low Dose

Xanomeline Low Dose

01-709-1088

NA

United States of America

12APR2014 / 11:59

1000001

Stratification Factor 1

Stratification Factor 2

Placebo

Placebo

[lsidem02.docx][/usr/lib/rstudio-server/bin/quarto/share/rmd/rmd.R] 12JAN2026, 16:10

Download RTF file

LSIDEM01
LSIMH01
Source Code
---
title: LSIDEM02
subtitle: Randomization Listing
---

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

{{< 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:              lsidem02.R

# Prep environment

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

# Define script level parameters

tblid <- "LSIDEM02"
fileid <- tblid
popfl <- "RANDFL"
key_cols <- c("COL1")
disp_cols <- paste0("COL", 1:9)
concat_sep <- " / "
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")

lsting <- adsl %>%
  mutate(
    COL1 = explicit_na(USUBJID, ""),
    COL2 = explicit_na(REGION1, ""),
    COL3 = explicit_na(COUNTRY_DECODE, ""),
    COL4 = case_when(
      !is.na(RANDDT) & any(names(adsl) == "RANDDTM") & !is.na(RANDDTM) ~
        paste0(
          toupper(format(RANDDT, "%d%b%Y")),
          concat_sep,
          substr(RANDDTM, 12, 16)
        ),
      !is.na(RANDDT) & any(names(adsl) == "RANDDTM") & is.na(RANDDTM) ~
        paste0(toupper(format(RANDDT, "%d%b%Y")), concat_sep, "--:--"),
      !is.na(RANDDT) & !any(names(adsl) == "RANDDTM") ~
        paste0(toupper(format(RANDDT, "%d%b%Y"))),
    ),
    COL5 = explicit_na(RANUM, ""),
    # Optional Column: COL6/STRAT1R
    COL6 = explicit_na(STRAT1R, ""),
    # Optional Column: COL7/STRAT2R
    COL7 = explicit_na(STRAT2R, ""),
    COL8 = explicit_na(TRT01P, ""),
    COL9 = explicit_na(TRT01A, "")
  ) %>%
  arrange(COL1)

lsting <- var_relabel(
  lsting,
  COL1 = "Subject ID",
  COL2 = "Region",
  COL3 = paste("Country", "Territory", sep = concat_sep),
  COL4 = paste("Randomization Date", "Time", sep = concat_sep),
  COL5 = "Randomization Number",
  # Optional Column: COL6/STRAT1R
  COL6 = "Stratification Factor 1",
  # Optional Column: COL7/STRAT2R
  COL7 = "Stratification Factor 2",
  COL8 = "Randomization Treatment Assignment",
  COL9 = "Actual Treatment"
)

# Build listing

result <- rlistings::as_listing(
  df = lsting,
  key_cols = c("COL1"),
  disp_cols = disp_cols
)

# Add titles and footnotes

result <- set_titles(result, tab_titles)

# Output listing

tt_to_tlgrtf(string_map = string_map, tt = head(result, 100), file = fileid, orientation = "landscape")
```
```{r result1, echo=FALSE, message=FALSE, warning=FALSE, test = list(result_v1 = "result")}
tt_to_flextable_j(head(result,100), 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