TL Catalog
  1. Listings
  2. Disposition of Subjects
  3. LSIDS02
  • 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. Disposition of Subjects
  3. LSIDS02

LSIDS02

Listing of Subjects Who Discontinued Study Participation Prematurely


Output

  • Preview
Code
# Program Name:              lsids02.R

# Prep environment

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

# Define script level parameters

tblid <- "LSIDS02"
fileid <- tblid
popfl <- "SAFFL"
trtvar <- "TRT01P"
key_cols <- c("COL0", "COL1")
disp_cols <- paste0("COL", 0:10)
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" & EOSSTT %in% c("DISCONTINUED"))

adexsum <- pharmaverseadamjnj::adexsum %>%
  filter(PARAMCD == "CUMDOSE") %>%
  select(STUDYID, USUBJID, PARAMCD, PARAM, AVAL)

adsl_adexsum <- left_join(
  adsl,
  adexsum,
  by = c(
    "STUDYID" = "STUDYID",
    "USUBJID" = "USUBJID"
  )
)

lsting <- adsl_adexsum %>%
  mutate(
    AGE = explicit_na(as.character(AGE), ""),
    SEX = explicit_na(SEX, ""),
    RACE_DECODE = explicit_na(RACE_DECODE, ""),
    AVAL = explicit_na(as.character(AVAL), ""),
    AVALU = case_when(
      !is.na(AVAL) ~
        stringr::str_extract(PARAM, "(?<=\\()([^()]*?)(?=\\)[^()]*$)"),
      is.na(AVAL) ~
        ""
    ),
    DCSREAS = explicit_na(DCSREAS, ""),
    DCSREASP = explicit_na(DCSREASP, ""),
    COL0 = explicit_na(.data[[trtvar]], ""),
    COL1 = explicit_na(USUBJID, ""),
    COL2 = paste(AGE, SEX, RACE_DECODE, sep = concat_sep),
    # Optional Column: COL3/LSVISIT
    COL3 = explicit_na(LSVISIT, ""),
    COL4 = explicit_na(as.character(EOSDY), ""),
    # Optional Column: COL5/LTVISIT
    COL5 = explicit_na(LTVISIT, ""),
    # Optional Column: COL6/TRTEDY
    COL6 = explicit_na(as.character(TRTEDY), ""),
    # Optional Column: COL7/CUMDOSE/CUMDOSU
    COL7 = paste0(AVAL, " ", AVALU),
    COL8 = ifelse(
      is.na(EOSDT),
      "",
      toupper(format(as.Date(EOSDT), format = "%d%b%Y"))
    ),
    COL9 = case_when(
      DCSREAS == "OTHER" ~
        paste0(DCSREAS, " (", stringr::str_to_sentence(DCSREASP), ")"),
      DCSREAS != "OTHER" ~
        DCSREAS
    ),
    # Optional Column: COL10/UNBLNDFL
    COL10 = ifelse(is.na(UNBLNDFL), "No", "Yes")
  ) %>%
  arrange(COL0, COL1)

lsting <- var_relabel(
  lsting,
  COL0 = "Treatment Group",
  COL1 = "Subject ID",
  COL2 = paste("Age (years)", "Sex", "Race", sep = concat_sep),
  # Optional Column: COL3/LSVISIT
  COL3 = "Last Study Visit~[super a]",
  COL4 = "Study Day~[super b] of Discontinuation",
  # Optional Column: COL5/LTVISIT
  COL5 = "Last Treatment Visit~[super c]",
  # Optional Column: COL6/TRTEDY
  COL6 = "Study Day~[super b] of Last Study Agent Administered",
  # Optional Column: COL7/CUMDOSE/CUMDOSU
  COL7 = "Total Dose (unit)~[super d]",
  COL8 = "Date of Discontinuation",
  COL9 = "Primary Reason for Discontinuation",
  # Optional Column: COL10/UNBLNDFL
  COL10 = "Was Blind Broken?"
)

# Build listing

result <- rlistings::as_listing(
  df = lsting,
  key_cols = key_cols,
  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")

LSIDS02: Listing of Subjects Who Discontinued Study Participation Prematurely; Analysis Set (Study jjcs - core)

Treatment Group

Subject ID

Age (years) / Sex / Race

Last Study Visita

Study Dayb of Discontinuation

Last Treatment Visitc

Study Dayb of Last Study Agent Administered

Total Dose (unit)d

Date of Discontinuation

Primary Reason for Discontinuation

Was Blind Broken?

Xanomeline High Dose

01-701-1146

75 / F / Unknown

Last Study Visit

42

Last Treatment Visit

400

682 [unit]

30JUN2013

Other

Yes

01-701-1181

79 / F / Not reported

Last Study Visit

8

Last Treatment Visit

200

3375 [unit]

12DEC2013

Other

Yes

01-701-1360

67 / M / Multiple

Last Study Visit

15

Last Treatment Visit

50

3744 [unit]

14AUG2013

Other

Yes

01-701-1444

63 / M / American Indian or Alaska Native

Last Study Visit

40

Last Treatment Visit

100

3217 [unit]

13FEB2013

Other

Yes

01-703-1076

69 / M / White

Last Study Visit

61

Last Treatment Visit

50

4866 [unit]

24DEC2013

Other

Yes

01-703-1335

67 / F / Not reported

Last Study Visit

69

Last Treatment Visit

300

4144 [unit]

24MAY2014

Other

Yes

01-703-1403

67 / M / Multiple

Last Study Visit

8

Last Treatment Visit

200

4799 [unit]

19DEC2012

Other

Yes

01-704-1017

77 / M / Asian

Last Study Visit

50

Last Treatment Visit

200

1561 [unit]

24NOV2013

Other

Yes

01-704-1065

75 / M / Multiple

Last Study Visit

62

Last Treatment Visit

300

4487 [unit]

24DEC2013

Other

Yes

01-704-1093

79 / M / American Indian or Alaska Native

Last Study Visit

98

Last Treatment Visit

400

1035 [unit]

20JUN2013

Other

Yes

01-705-1281

73 / F / Not reported

Last Study Visit

110

Last Treatment Visit

300

4016 [unit]

17MAR2014

Other

Yes

01-705-1303

72 / M / Unknown

Last Study Visit

169

Last Treatment Visit

200

4880 [unit]

02JUN2014

Other

Yes

01-705-1310

74 / F / Native Hawaiian or other Pacific Islander

Last Study Visit

83

Last Treatment Visit

50

2580 [unit]

23JAN2014

Other

Yes

01-705-1382

82 / M / Multiple

Last Study Visit

1

Last Treatment Visit

100

868 [unit]

13MAY2013

Other

Yes

01-708-1213

76 / F / Unknown

Last Study Visit

18

Last Treatment Visit

200

4105 [unit]

26FEB2013

Other

Yes

01-708-1216

78 / M / Asian

Last Study Visit

44

Last Treatment Visit

100

4138 [unit]

06DEC2012

Other

Yes

01-708-1236

86 / F / White

Last Study Visit

6

Last Treatment Visit

300

3262 [unit]

26SEP2013

Other

Yes

01-708-1347

61 / F / White

Last Study Visit

60

Last Treatment Visit

200

2169 [unit]

18JUN2013

Other

Yes

01-708-1372

84 / M / Not reported

Last Study Visit

29

Last Treatment Visit

400

1322 [unit]

10MAY2013

Other

Yes

01-709-1329

70 / M / Native Hawaiian or other Pacific Islander

Last Study Visit

15

Last Treatment Visit

300

756 [unit]

29AUG2013

Other

Yes

01-710-1137

79 / F / Multiple

Last Study Visit

34

Last Treatment Visit

300

4505 [unit]

13NOV2013

Other

Yes

01-710-1142

76 / F / Not reported

Last Study Visit

22

Last Treatment Visit

100

1884 [unit]

23OCT2012

Other

Yes

01-710-1278

81 / M / Asian

Last Study Visit

70

Last Treatment Visit

300

1435 [unit]

03MAR2013

Other

Yes

01-711-1433

84 / F / Asian

Last Study Visit

11

Last Treatment Visit

400

2045 [unit]

06FEB2013

Other

Yes

01-713-1141

79 / M / White

Last Study Visit

68

Last Treatment Visit

400

2384 [unit]

06AUG2013

Other

Yes

01-714-1425

81 / M / Black or African American

Last Study Visit

8

Last Treatment Visit

50

3686 [unit]

22AUG2013

Other

Yes

01-715-1319

65 / M / Multiple

Last Study Visit

30

Last Treatment Visit

300

3797 [unit]

18MAR2013

Other

Yes

01-715-1321

75 / F / Native Hawaiian or other Pacific Islander

Last Study Visit

71

Last Treatment Visit

400

1625 [unit]

22APR2014

Other

Yes

01-716-1189

81 / M / Asian

Last Study Visit

146

Last Treatment Visit

400

1369 [unit]

03MAR2013

Other

Yes

01-716-1229

73 / F / Asian

Last Study Visit

42

Last Treatment Visit

200

3984 [unit]

02APR2013

Other

Yes

01-717-1357

77 / M / White

Last Study Visit

173

Last Treatment Visit

100

3353 [unit]

20OCT2013

Other

Yes

01-718-1101

82 / M / Asian

Last Study Visit

167

Last Treatment Visit

100

4406 [unit]

02AUG2013

Other

Yes

01-718-1328

86 / M / Not reported

Last Study Visit

90

Last Treatment Visit

100

3352 [unit]

01MAY2013

Other

Yes

01-718-1371

69 / F / Unknown

Last Study Visit

105

Last Treatment Visit

400

3454 [unit]

08AUG2013

Other

Yes

Xanomeline Low Dose

01-701-1111

81 / F / White

Last Study Visit

11

Last Treatment Visit

200

2572 [unit]

17SEP2012

Other

Yes

01-701-1115

84 / M / Black or African American

Last Study Visit

55

Last Treatment Visit

400

3252 [unit]

23JAN2013

Other

Yes

01-701-1211

76 / F / Other

Last Study Visit

61

Last Treatment Visit

50

4245 [unit]

14JAN2013

Other

Yes

01-701-1294

67 / M / Other

Last Study Visit

83

Last Treatment Visit

400

2017 [unit]

14JUN2013

Other

Yes

01-701-1341

51 / M / American Indian or Alaska Native

Last Study Visit

34

Last Treatment Visit

100

1354 [unit]

07FEB2013

Other

Yes

01-701-1429

84 / F / American Indian or Alaska Native

Last Study Visit

43

Last Treatment Visit

50

2949 [unit]

30APR2013

Other

Yes

01-703-1119

81 / F / Native Hawaiian or other Pacific Islander

Last Study Visit

114

Last Treatment Visit

300

2288 [unit]

13JUN2013

Other

Yes

01-703-1182

84 / M / Other

Last Study Visit

57

Last Treatment Visit

300

2075 [unit]

12DEC2013

Other

Yes

01-703-1197

76 / F / Other

Last Study Visit

37

Last Treatment Visit

300

1716 [unit]

22JUL2013

Other

Yes

01-704-1009

83 / M / Unknown

Last Study Visit

37

Last Treatment Visit

300

2204 [unit]

02OCT2013

Other

Yes

01-704-1025

81 / F / Asian

Last Study Visit

64

Last Treatment Visit

200

958 [unit]

29NOV2013

Other

Yes

01-704-1114

77 / M / Multiple

Last Study Visit

167

Last Treatment Visit

50

967 [unit]

08JUL2013

Other

Yes

01-704-1120

71 / F / Black or African American

Last Study Visit

64

Last Treatment Visit

50

4345 [unit]

03FEB2014

Other

Yes

01-704-1325

81 / M / White

Last Study Visit

106

Last Treatment Visit

300

4663 [unit]

06AUG2014

Other

Yes

01-705-1199

87 / M / Black or African American

Last Study Visit

14

Last Treatment Visit

50

493 [unit]

29SEP2013

Other

Yes

01-705-1393

84 / F / Native Hawaiian or other Pacific Islander

Last Study Visit

167

Last Treatment Visit

300

3762 [unit]

20FEB2013

Other

Yes

01-708-1019

68 / M / Asian

Last Study Visit

35

Last Treatment Visit

400

1177 [unit]

23JAN2014

Other

Yes

01-708-1032

62 / M / Multiple

Last Study Visit

29

Last Treatment Visit

100

3770 [unit]

09MAR2013

Other

Yes

01-708-1272

82 / M / Not reported

Last Study Visit

58

Last Treatment Visit

200

201 [unit]

04APR2013

Other

Yes

01-708-1297

61 / M / Not reported

Last Study Visit

104

Last Treatment Visit

300

3732 [unit]

08MAY2013

Other

Yes

01-709-1081

86 / F / White

Last Study Visit

113

Last Treatment Visit

100

4439 [unit]

10MAY2014

Other

Yes

01-709-1102

71 / F / American Indian or Alaska Native

Last Study Visit

76

Last Treatment Visit

100

250 [unit]

31MAR2013

Other

Yes

01-709-1217

77 / M / American Indian or Alaska Native

Last Study Visit

114

Last Treatment Visit

400

3360 [unit]

25JUN2013

Other

Yes

01-709-1285

87 / M / Native Hawaiian or other Pacific Islander

Last Study Visit

69

Last Treatment Visit

100

3992 [unit]

31MAY2013

Other

Yes

01-710-1002

88 / M / American Indian or Alaska Native

Last Study Visit

5

Last Treatment Visit

100

3307 [unit]

18JAN2014

Other

Yes

01-710-1053

84 / F / White

Last Study Visit

52

Last Treatment Visit

100

1326 [unit]

15FEB2013

Other

Yes

01-710-1154

84 / M / American Indian or Alaska Native

Last Study Visit

42

Last Treatment Visit

100

774 [unit]

09MAY2014

Other

Yes

01-710-1166

81 / F / White

Last Study Visit

121

Last Treatment Visit

200

2262 [unit]

30MAR2013

Other

Yes

01-710-1270

83 / F / American Indian or Alaska Native

Last Study Visit

18

Last Treatment Visit

300

1047 [unit]

01MAR2014

Other

Yes

01-710-1358

82 / M / Asian

Last Study Visit

177

Last Treatment Visit

100

1754 [unit]

12MAR2013

Other

Yes

01-710-1385

77 / M / Multiple

Last Study Visit

113

Last Treatment Visit

400

4978 [unit]

18FEB2013

Other

Yes

01-711-1143

76 / F / Black or African American

Last Study Visit

60

Last Treatment Visit

200

4182 [unit]

01JUN2013

Other

Yes

01-713-1448

71 / F / American Indian or Alaska Native

Last Study Visit

119

Last Treatment Visit

100

774 [unit]

17MAY2014

Other

Yes

01-714-1068

79 / F / Other

Last Study Visit

70

Last Treatment Visit

50

1659 [unit]

16OCT2013

Other

Yes

01-716-1063

80 / M / Asian

Last Study Visit

112

Last Treatment Visit

50

4153 [unit]

28AUG2013

Other

Yes

01-716-1094

82 / M / Black or African American

Last Study Visit

39

Last Treatment Visit

200

2465 [unit]

26JAN2013

Other

Yes

01-716-1311

78 / M / Black or African American

Last Study Visit

140

Last Treatment Visit

50

626 [unit]

30SEP2014

Other

Yes

01-718-1079

67 / F / White

Last Study Visit

49

Last Treatment Visit

100

102 [unit]

06NOV2012

Other

Yes

01-718-1250

82 / F / Black or African American

Last Study Visit

141

Last Treatment Visit

100

665 [unit]

08FEB2014

Other

Yes

Placebo

01-701-1023

64 / M / Black or African American

Last Study Visit

29

Last Treatment Visit

50

795 [unit]

02SEP2012

Other

Yes

01-701-1047

85 / F / Native Hawaiian or other Pacific Islander

Last Study Visit

46

Last Treatment Visit

50

208 [unit]

29MAR2013

Other

Yes

01-701-1345

63 / F / Other

Last Study Visit

162

Last Treatment Visit

50

2543 [unit]

18MAR2014

Other

Yes

01-701-1387

87 / F / Unknown

Last Study Visit

14

Last Treatment Visit

300

4173 [unit]

25MAR2014

Other

Yes

01-703-1096

81 / F / Black or African American

Last Study Visit

64

Last Treatment Visit

300

1544 [unit]

29MAR2013

Other

Yes

01-703-1175

75 / M / Multiple

Last Study Visit

12

Last Treatment Visit

100

1562 [unit]

31DEC2013

Other

Yes

01-704-1233

87 / F / Not reported

Last Study Visit

116

Last Treatment Visit

400

4514 [unit]

14JUL2013

Other

Yes

01-704-1260

71 / F / Not reported

Last Study Visit

142

Last Treatment Visit

400

2313 [unit]

18JAN2013

Other

Yes

01-705-1059

66 / F / Other

Last Study Visit

123

Last Treatment Visit

100

2531 [unit]

05DEC2013

Other

Yes

01-708-1378

67 / M / Other

Last Study Visit

148

Last Treatment Visit

400

2773 [unit]

28JAN2014

Other

Yes

01-709-1259

82 / M / Other

Last Study Visit

139

Last Treatment Visit

300

4418 [unit]

13JUN2013

Other

Yes

01-710-1314

78 / F / Asian

Last Study Visit

32

Last Treatment Visit

300

4148 [unit]

25MAY2013

Other

Yes

01-710-1315

83 / F / Unknown

Last Study Visit

140

Last Treatment Visit

200

2660 [unit]

16JUL2013

Other

Yes

01-715-1155

59 / F / Multiple

Last Study Visit

135

Last Treatment Visit

200

655 [unit]

26APR2014

Other

Yes

01-717-1201

85 / F / Native Hawaiian or other Pacific Islander

Last Study Visit

65

Last Treatment Visit

50

2506 [unit]

21FEB2014

Other

Yes

01-718-1172

74 / M / Multiple

Last Study Visit

70

Last Treatment Visit

50

4945 [unit]

29NOV2013

Other

Yes

a Last study visit is the last visit which the subject attended before discontinuing study participation prematurely.

b Study day is relative to [the start of [study treatment]].

c Last treatment visit is the visit which the subject attended before discontinuing study participation where treatment was administered.

d Total dose is defined as a cumulative sum of all study agent administered.

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

Download RTF file

LSIDS01
LSIDS03
Source Code
---
title: LSIDS02
subtitle: Listing of Subjects Who Discontinued Study Participation Prematurely
---

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

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

# Prep environment

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

# Define script level parameters

tblid <- "LSIDS02"
fileid <- tblid
popfl <- "SAFFL"
trtvar <- "TRT01P"
key_cols <- c("COL0", "COL1")
disp_cols <- paste0("COL", 0:10)
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" & EOSSTT %in% c("DISCONTINUED"))

adexsum <- pharmaverseadamjnj::adexsum %>%
  filter(PARAMCD == "CUMDOSE") %>%
  select(STUDYID, USUBJID, PARAMCD, PARAM, AVAL)

adsl_adexsum <- left_join(
  adsl,
  adexsum,
  by = c(
    "STUDYID" = "STUDYID",
    "USUBJID" = "USUBJID"
  )
)

lsting <- adsl_adexsum %>%
  mutate(
    AGE = explicit_na(as.character(AGE), ""),
    SEX = explicit_na(SEX, ""),
    RACE_DECODE = explicit_na(RACE_DECODE, ""),
    AVAL = explicit_na(as.character(AVAL), ""),
    AVALU = case_when(
      !is.na(AVAL) ~
        stringr::str_extract(PARAM, "(?<=\\()([^()]*?)(?=\\)[^()]*$)"),
      is.na(AVAL) ~
        ""
    ),
    DCSREAS = explicit_na(DCSREAS, ""),
    DCSREASP = explicit_na(DCSREASP, ""),
    COL0 = explicit_na(.data[[trtvar]], ""),
    COL1 = explicit_na(USUBJID, ""),
    COL2 = paste(AGE, SEX, RACE_DECODE, sep = concat_sep),
    # Optional Column: COL3/LSVISIT
    COL3 = explicit_na(LSVISIT, ""),
    COL4 = explicit_na(as.character(EOSDY), ""),
    # Optional Column: COL5/LTVISIT
    COL5 = explicit_na(LTVISIT, ""),
    # Optional Column: COL6/TRTEDY
    COL6 = explicit_na(as.character(TRTEDY), ""),
    # Optional Column: COL7/CUMDOSE/CUMDOSU
    COL7 = paste0(AVAL, " ", AVALU),
    COL8 = ifelse(
      is.na(EOSDT),
      "",
      toupper(format(as.Date(EOSDT), format = "%d%b%Y"))
    ),
    COL9 = case_when(
      DCSREAS == "OTHER" ~
        paste0(DCSREAS, " (", stringr::str_to_sentence(DCSREASP), ")"),
      DCSREAS != "OTHER" ~
        DCSREAS
    ),
    # Optional Column: COL10/UNBLNDFL
    COL10 = ifelse(is.na(UNBLNDFL), "No", "Yes")
  ) %>%
  arrange(COL0, COL1)

lsting <- var_relabel(
  lsting,
  COL0 = "Treatment Group",
  COL1 = "Subject ID",
  COL2 = paste("Age (years)", "Sex", "Race", sep = concat_sep),
  # Optional Column: COL3/LSVISIT
  COL3 = "Last Study Visit~[super a]",
  COL4 = "Study Day~[super b] of Discontinuation",
  # Optional Column: COL5/LTVISIT
  COL5 = "Last Treatment Visit~[super c]",
  # Optional Column: COL6/TRTEDY
  COL6 = "Study Day~[super b] of Last Study Agent Administered",
  # Optional Column: COL7/CUMDOSE/CUMDOSU
  COL7 = "Total Dose (unit)~[super d]",
  COL8 = "Date of Discontinuation",
  COL9 = "Primary Reason for Discontinuation",
  # Optional Column: COL10/UNBLNDFL
  COL10 = "Was Blind Broken?"
)

# Build listing

result <- rlistings::as_listing(
  df = lsting,
  key_cols = key_cols,
  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