Skip to contents

Create flextable output from display templates

Usage

tbl_display(
  datain,
  bylabel = NA,
  dpthead = "  ",
  font = "Arial",
  fontsize = 10,
  boldheadyn = "N"
)

Arguments

datain

Input dataframe

bylabel

Change BYVAR names to label, if any.

dpthead

String to become name of the column containing categories (DPTVAL) in output.

font

Font face for text inside table

fontsize

Font size for text inside table

boldheadyn

Y/N to determine if table header should be bold

Value

flextable object

Examples

mentry_df <- adsl |>
  mentry(
    subset = NA_character_,
    byvar = NA_character_,
    trtvar = "TRT01A",
    trtsort = "TRT01AN",
    subgrpvar = "SEX/SEXN",
    trttotalyn = "N",
    add_grpmiss = "N",
    sgtotalyn = "N",
    pop_fil = "SAFFL"
  )
repdata <- adsl_summary(
  datain = mentry_df,
  vars = "AGEGR1~AGE-S~RACE"
) |>
  display_bign_head(mentry_df) |>
  tbl_processor(
    dptlabel = "Age Group~Age~Race",
    statlabel = NA,
    addrowvars = "DPTVAR"
  )
#> mcatstat success
#> mcatstat success
#> msum success
tbl_display(
  datain = repdata,
  bylabel = NA,
  dpthead = "  "
)

Placebo (N=86)

Xanomeline Low Dose (N=84)

Xanomeline High Dose (N=84)

F (N=53)

M (N=33)

F (N=50)

M (N=34)

F (N=40)

M (N=44)

Age Group

  <65

9 (10.47%)

5 ( 5.81%)

5 ( 5.95%)

3 ( 3.57%)

5 ( 5.95%)

6 ( 7.14%)

  65-80

22 (25.58%)

20 (23.26%)

28 (33.33%)

19 (22.62%)

28 (33.33%)

27 (32.14%)

  >80

22 (25.58%)

8 ( 9.30%)

17 (20.24%)

12 (14.29%)

7 ( 8.33%)

11 (13.10%)

Age

  n

53

33

50

34

40

44

  minmaxc

(59.00,89.00)

(52.00,85.00)

(54.00,87.00)

(51.00,88.00)

(56.00,88.00)

(56.00,86.00)

  mean(sd)

76.36 (8.73)

73.36 (8.15)

75.68 (8.09)

75.65 (8.69)

74.67 (7.67)

74.11 (8.16)

  median

78.00

74.00

77.50

77.50

76.00

77.00

  q1q3

(70.00, 84.00)

(69.00, 80.00)

(72.00, 81.00)

(68.00, 82.00)

(72.00, 79.00)

(69.00, 80.50)

Race

  WHITE

48 (55.81%)

30 (34.88%)

44 (52.38%)

34 (40.48%)

34 (40.48%)

40 (47.62%)

  BLACK OR AFRICAN AMERICAN

5 ( 5.81%)

3 ( 3.49%)

6 ( 7.14%)

0

6 ( 7.14%)

3 ( 3.57%)

  AMERICAN INDIAN OR ALASKA NATIVE

0

0

0

0

0

1 ( 1.19%)