Pagination of a listing. This can be vertical for long listings with many rows or horizontal if there are many columns.
Usage
paginate_listing(
lsting,
page_type = "letter",
font_family = "Courier",
font_size = 8,
lineheight = 1,
landscape = FALSE,
pg_width = NULL,
pg_height = NULL,
margins = c(top = 0.5, bottom = 0.5, left = 0.75, right = 0.75),
lpp = NA_integer_,
cpp = NA_integer_,
colwidths = propose_column_widths(lsting),
tf_wrap = !is.null(max_width),
max_width = NULL,
verbose = FALSE
)
Arguments
- lsting
listing_df. The listing to paginate.
- page_type
character(1). Name of a page type. See
page_types
. Ignored whenpg_width
andpg_height
are set directly.- font_family
character(1). Name of a font family. An error will be thrown if the family named is not monospaced. Defaults to Courier.
- font_size
numeric(1). Font size, defaults to 12.
- lineheight
numeric(1). Line height, defaults to 1.
- landscape
logical(1). Should the dimensions of
page_type
be inverted for landscape? Defaults toFALSE
, ignored whenpg_width
andpg_height
are set directly.- pg_width
numeric(1). Page width in inches.
- pg_height
numeric(1). Page height in inches.
- margins
numeric(4). Named numeric vector containing
'bottom'
,'left'
,'top'
, and'right'
margins in inches. Defaults to.5
inches for both vertical margins and.75
for both horizontal margins.- lpp
numeric(1) or NULL. Number of row lines (not counting titles and footers) to have per page. Standard is
70
whileNULL
disables vertical pagination.- cpp
numeric(1) or NULL. Width (in characters) of the pages for horizontal pagination.
NULL
(the default) indicates no horizontal pagination should be done.- colwidths
numeric vector. Column widths (in characters) for use with vertical pagination.
- tf_wrap
logical(1). Should the texts for title, subtitle, and footnotes be wrapped?
- max_width
integer(1), character(1) or
NULL
. Width that title and footer (including footnotes) materials should be word-wrapped to. IfNULL
, it is set to the current print width of the session (getOption("width")
). If set to"auto"
, the width of the table (plus any table inset) is used. Ignored completely iftf_wrap
isFALSE
.- verbose
logical(1). Should additional informative messages about the search for pagination breaks be shown. Defaults to
FALSE
.
Value
A list of listings' objects that are meant to be on separated pages.
For pag_tt_indices
a list of paginated-groups of row-indices of lsting
.
for paginate_listing
a list containing separate
listing_df
objects for each page, for pag_listing_indices
,
a list of indices in the direction being paginated corresponding
to the individual pages in that dimension.
Examples
dat <- ex_adae
lsting <- as_listing(dat[1:25, ], disp_cols = c("USUBJID", "AESOC", "RACE", "AETOXGR", "BMRKR1"))
mat <- matrix_form(lsting)
cat(toString(mat))
#> Study Identifier Unique Subject Identifier Primary System Organ Class Race Analysis Toxicity Grade Continous Level Biomarker 1
#> —————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
#> AB12345 AB12345-BRA-1-id-134 cl B WHITE 3 6.46299057842479
#> AB12345-BRA-1-id-134 cl D WHITE 3 6.46299057842479
#> AB12345-BRA-1-id-134 cl A WHITE 2 6.46299057842479
#> AB12345-BRA-1-id-134 cl A WHITE 2 6.46299057842479
#> AB12345-BRA-1-id-141 cl B WHITE 3 7.51607612428241
#> AB12345-BRA-1-id-141 cl D WHITE 1 7.51607612428241
#> AB12345-BRA-1-id-141 cl A WHITE 1 7.51607612428241
#> AB12345-BRA-1-id-141 cl A WHITE 2 7.51607612428241
#> AB12345-BRA-1-id-141 cl A WHITE 1 7.51607612428241
#> AB12345-BRA-1-id-141 cl D WHITE 5 7.51607612428241
#> AB12345-BRA-1-id-236 cl B BLACK OR AFRICAN AMERICAN 5 7.66300121077566
#> AB12345-BRA-1-id-236 cl B BLACK OR AFRICAN AMERICAN 5 7.66300121077566
#> AB12345-BRA-1-id-236 cl B BLACK OR AFRICAN AMERICAN 5 7.66300121077566
#> AB12345-BRA-1-id-265 cl C WHITE 2 10.323346349886
#> AB12345-BRA-1-id-265 cl D WHITE 3 10.323346349886
#> AB12345-BRA-1-id-265 cl D WHITE 5 10.323346349886
#> AB12345-BRA-1-id-265 cl C WHITE 4 10.323346349886
#> AB12345-BRA-1-id-42 cl C BLACK OR AFRICAN AMERICAN 2 2.26753940777848
#> AB12345-BRA-1-id-42 cl D BLACK OR AFRICAN AMERICAN 5 2.26753940777848
#> AB12345-BRA-1-id-42 cl C BLACK OR AFRICAN AMERICAN 2 2.26753940777848
#> AB12345-BRA-1-id-42 cl A BLACK OR AFRICAN AMERICAN 2 2.26753940777848
#> AB12345-BRA-1-id-42 cl B BLACK OR AFRICAN AMERICAN 1 2.26753940777848
#> AB12345-BRA-1-id-42 cl A BLACK OR AFRICAN AMERICAN 2 2.26753940777848
#> AB12345-BRA-1-id-42 cl B BLACK OR AFRICAN AMERICAN 5 2.26753940777848
#> AB12345-BRA-1-id-42 cl A BLACK OR AFRICAN AMERICAN 2 2.26753940777848
paginate_listing(lsting, lpp = 10)
#> [[1]]
#> Study Identifier Unique Subject Identifier Primary System Organ Class Race
#> —————————————————————————————————————————————————————————————————————————————————
#> AB12345 AB12345-BRA-1-id-134 cl B WHITE
#> AB12345-BRA-1-id-134 cl D WHITE
#> AB12345-BRA-1-id-134 cl A WHITE
#> AB12345-BRA-1-id-134 cl A WHITE
#> AB12345-BRA-1-id-141 cl B WHITE
#> AB12345-BRA-1-id-141 cl D WHITE
#> AB12345-BRA-1-id-141 cl A WHITE
#> AB12345-BRA-1-id-141 cl A WHITE
#>
#> [[2]]
#> Study Identifier Analysis Toxicity Grade Continous Level Biomarker 1
#> ————————————————————————————————————————————————————————————————————————
#> AB12345 3 6.46299057842479
#> 3 6.46299057842479
#> 2 6.46299057842479
#> 2 6.46299057842479
#> 3 7.51607612428241
#> 1 7.51607612428241
#> 1 7.51607612428241
#> 2 7.51607612428241
#>
#> [[3]]
#> Study Identifier Unique Subject Identifier Primary System Organ Class Race
#> —————————————————————————————————————————————————————————————————————————————————————————————————————
#> AB12345 AB12345-BRA-1-id-141 cl A WHITE
#> AB12345-BRA-1-id-141 cl D WHITE
#> AB12345-BRA-1-id-236 cl B BLACK OR AFRICAN AMERICAN
#> AB12345-BRA-1-id-236 cl B BLACK OR AFRICAN AMERICAN
#> AB12345-BRA-1-id-236 cl B BLACK OR AFRICAN AMERICAN
#> AB12345-BRA-1-id-265 cl C WHITE
#> AB12345-BRA-1-id-265 cl D WHITE
#> AB12345-BRA-1-id-265 cl D WHITE
#>
#> [[4]]
#> Study Identifier Analysis Toxicity Grade Continous Level Biomarker 1
#> ————————————————————————————————————————————————————————————————————————
#> AB12345 1 7.51607612428241
#> 5 7.51607612428241
#> 5 7.66300121077566
#> 5 7.66300121077566
#> 5 7.66300121077566
#> 2 10.323346349886
#> 3 10.323346349886
#> 5 10.323346349886
#>
#> [[5]]
#> Study Identifier Unique Subject Identifier Primary System Organ Class Race
#> —————————————————————————————————————————————————————————————————————————————————————————————————————
#> AB12345 AB12345-BRA-1-id-265 cl C WHITE
#> AB12345-BRA-1-id-42 cl C BLACK OR AFRICAN AMERICAN
#> AB12345-BRA-1-id-42 cl D BLACK OR AFRICAN AMERICAN
#> AB12345-BRA-1-id-42 cl C BLACK OR AFRICAN AMERICAN
#> AB12345-BRA-1-id-42 cl A BLACK OR AFRICAN AMERICAN
#> AB12345-BRA-1-id-42 cl B BLACK OR AFRICAN AMERICAN
#>
#> [[6]]
#> Study Identifier Analysis Toxicity Grade Continous Level Biomarker 1
#> ————————————————————————————————————————————————————————————————————————
#> AB12345 4 10.323346349886
#> 2 2.26753940777848
#> 5 2.26753940777848
#> 2 2.26753940777848
#> 2 2.26753940777848
#> 1 2.26753940777848
#>
#> [[7]]
#> Study Identifier Unique Subject Identifier Primary System Organ Class Race
#> —————————————————————————————————————————————————————————————————————————————————————————————————————
#> AB12345 AB12345-BRA-1-id-42 cl A BLACK OR AFRICAN AMERICAN
#> AB12345-BRA-1-id-42 cl B BLACK OR AFRICAN AMERICAN
#> AB12345-BRA-1-id-42 cl A BLACK OR AFRICAN AMERICAN
#>
#> [[8]]
#> Study Identifier Analysis Toxicity Grade Continous Level Biomarker 1
#> ————————————————————————————————————————————————————————————————————————
#> AB12345 2 2.26753940777848
#> 5 2.26753940777848
#> 2 2.26753940777848
#>
paginate_listing(lsting, cpp = 100, lpp = 40)
#> [[1]]
#> Study Identifier Unique Subject Identifier Primary System Organ Class
#> —————————————————————————————————————————————————————————————————————————
#> AB12345 AB12345-BRA-1-id-134 cl B
#> AB12345-BRA-1-id-134 cl D
#> AB12345-BRA-1-id-134 cl A
#> AB12345-BRA-1-id-134 cl A
#> AB12345-BRA-1-id-141 cl B
#> AB12345-BRA-1-id-141 cl D
#> AB12345-BRA-1-id-141 cl A
#> AB12345-BRA-1-id-141 cl A
#> AB12345-BRA-1-id-141 cl A
#> AB12345-BRA-1-id-141 cl D
#> AB12345-BRA-1-id-236 cl B
#> AB12345-BRA-1-id-236 cl B
#> AB12345-BRA-1-id-236 cl B
#> AB12345-BRA-1-id-265 cl C
#> AB12345-BRA-1-id-265 cl D
#> AB12345-BRA-1-id-265 cl D
#> AB12345-BRA-1-id-265 cl C
#> AB12345-BRA-1-id-42 cl C
#> AB12345-BRA-1-id-42 cl D
#> AB12345-BRA-1-id-42 cl C
#> AB12345-BRA-1-id-42 cl A
#> AB12345-BRA-1-id-42 cl B
#> AB12345-BRA-1-id-42 cl A
#> AB12345-BRA-1-id-42 cl B
#> AB12345-BRA-1-id-42 cl A
#>
#> [[2]]
#> Study Identifier Race Analysis Toxicity Grade
#> ——————————————————————————————————————————————————————————————————————
#> AB12345 WHITE 3
#> WHITE 3
#> WHITE 2
#> WHITE 2
#> WHITE 3
#> WHITE 1
#> WHITE 1
#> WHITE 2
#> WHITE 1
#> WHITE 5
#> BLACK OR AFRICAN AMERICAN 5
#> BLACK OR AFRICAN AMERICAN 5
#> BLACK OR AFRICAN AMERICAN 5
#> WHITE 2
#> WHITE 3
#> WHITE 5
#> WHITE 4
#> BLACK OR AFRICAN AMERICAN 2
#> BLACK OR AFRICAN AMERICAN 5
#> BLACK OR AFRICAN AMERICAN 2
#> BLACK OR AFRICAN AMERICAN 2
#> BLACK OR AFRICAN AMERICAN 1
#> BLACK OR AFRICAN AMERICAN 2
#> BLACK OR AFRICAN AMERICAN 5
#> BLACK OR AFRICAN AMERICAN 2
#>
#> [[3]]
#> Study Identifier Continous Level Biomarker 1
#> ——————————————————————————————————————————————
#> AB12345 6.46299057842479
#> 6.46299057842479
#> 6.46299057842479
#> 6.46299057842479
#> 7.51607612428241
#> 7.51607612428241
#> 7.51607612428241
#> 7.51607612428241
#> 7.51607612428241
#> 7.51607612428241
#> 7.66300121077566
#> 7.66300121077566
#> 7.66300121077566
#> 10.323346349886
#> 10.323346349886
#> 10.323346349886
#> 10.323346349886
#> 2.26753940777848
#> 2.26753940777848
#> 2.26753940777848
#> 2.26753940777848
#> 2.26753940777848
#> 2.26753940777848
#> 2.26753940777848
#> 2.26753940777848
#>
paginate_listing(lsting, cpp = 80, lpp = 40, verbose = TRUE)
#> Determining lines required for header content: 0 title and 2 table header lines
#> Determining lines required for footer content: 0 lines
#> Lines per page available for tables rows: 38 (original: 40)
#> Checking pagination after row 25
#> ....................... OK [25 lines]
#> Adjusted characters per page: 80 [original: 80, table inset: 0]
#> Checking pagination after column 6
#> ....................... FAIL: requires 160 chars (6 cols).
#> Checking pagination after column 5
#> ....................... FAIL: requires 130 chars (5 cols).
#> Checking pagination after column 4
#> ....................... FAIL: requires 104 chars (4 cols).
#> Checking pagination after column 3
#> ....................... OK [76 chars]
#> Checking pagination after column 6
#> ....................... FAIL: requires 84 chars (3 cols).
#> Checking pagination after column 5
#> ....................... OK [73 chars]
#> Checking pagination after column 6
#> ....................... OK [49 chars]
#> [[1]]
#> Study Identifier Unique Subject Identifier Primary System Organ Class
#> —————————————————————————————————————————————————————————————————————————
#> AB12345 AB12345-BRA-1-id-134 cl B
#> AB12345-BRA-1-id-134 cl D
#> AB12345-BRA-1-id-134 cl A
#> AB12345-BRA-1-id-134 cl A
#> AB12345-BRA-1-id-141 cl B
#> AB12345-BRA-1-id-141 cl D
#> AB12345-BRA-1-id-141 cl A
#> AB12345-BRA-1-id-141 cl A
#> AB12345-BRA-1-id-141 cl A
#> AB12345-BRA-1-id-141 cl D
#> AB12345-BRA-1-id-236 cl B
#> AB12345-BRA-1-id-236 cl B
#> AB12345-BRA-1-id-236 cl B
#> AB12345-BRA-1-id-265 cl C
#> AB12345-BRA-1-id-265 cl D
#> AB12345-BRA-1-id-265 cl D
#> AB12345-BRA-1-id-265 cl C
#> AB12345-BRA-1-id-42 cl C
#> AB12345-BRA-1-id-42 cl D
#> AB12345-BRA-1-id-42 cl C
#> AB12345-BRA-1-id-42 cl A
#> AB12345-BRA-1-id-42 cl B
#> AB12345-BRA-1-id-42 cl A
#> AB12345-BRA-1-id-42 cl B
#> AB12345-BRA-1-id-42 cl A
#>
#> [[2]]
#> Study Identifier Race Analysis Toxicity Grade
#> ——————————————————————————————————————————————————————————————————————
#> AB12345 WHITE 3
#> WHITE 3
#> WHITE 2
#> WHITE 2
#> WHITE 3
#> WHITE 1
#> WHITE 1
#> WHITE 2
#> WHITE 1
#> WHITE 5
#> BLACK OR AFRICAN AMERICAN 5
#> BLACK OR AFRICAN AMERICAN 5
#> BLACK OR AFRICAN AMERICAN 5
#> WHITE 2
#> WHITE 3
#> WHITE 5
#> WHITE 4
#> BLACK OR AFRICAN AMERICAN 2
#> BLACK OR AFRICAN AMERICAN 5
#> BLACK OR AFRICAN AMERICAN 2
#> BLACK OR AFRICAN AMERICAN 2
#> BLACK OR AFRICAN AMERICAN 1
#> BLACK OR AFRICAN AMERICAN 2
#> BLACK OR AFRICAN AMERICAN 5
#> BLACK OR AFRICAN AMERICAN 2
#>
#> [[3]]
#> Study Identifier Continous Level Biomarker 1
#> ——————————————————————————————————————————————
#> AB12345 6.46299057842479
#> 6.46299057842479
#> 6.46299057842479
#> 6.46299057842479
#> 7.51607612428241
#> 7.51607612428241
#> 7.51607612428241
#> 7.51607612428241
#> 7.51607612428241
#> 7.51607612428241
#> 7.66300121077566
#> 7.66300121077566
#> 7.66300121077566
#> 10.323346349886
#> 10.323346349886
#> 10.323346349886
#> 10.323346349886
#> 2.26753940777848
#> 2.26753940777848
#> 2.26753940777848
#> 2.26753940777848
#> 2.26753940777848
#> 2.26753940777848
#> 2.26753940777848
#> 2.26753940777848
#>