@@ -56,8 +56,8 @@ paginate_listing <- function(lsting,
5656 tf_wrap = ! is.null(max_width ),
5757 max_width = NULL ,
5858 verbose = FALSE ) {
59+ # process lists of listings
5960 if (! is(lsting , " listing_df" )) {
60- # process lists of listings
6161 checkmate :: assert_true(all(unlist(lapply(lsting , is , " listing_df" ))))
6262 if (! " colwidths" %in% as.list(match.call())) {
6363 all_colwidths <- lapply(lsting , propose_column_widths )
@@ -72,58 +72,58 @@ paginate_listing <- function(lsting,
7272 )
7373
7474 ret <- unlist(lsting_list , recursive = FALSE )
75- ret
76- } else {
77- checkmate :: assert_flag(tf_wrap )
78- checkmate :: assert_count(max_width , null.ok = TRUE )
79- checkmate :: assert_flag(verbose )
80- checkmate :: assert_class(lsting , " listing_df" )
81- checkmate :: assert_numeric(colwidths , lower = 0 , len = length(listing_dispcols(lsting )), null.ok = TRUE )
75+ return (ret )
76+ }
8277
83- indx <- paginate_indices(lsting ,
84- page_type = page_type ,
85- font_family = font_family ,
86- font_size = font_size ,
87- lineheight = lineheight ,
88- landscape = landscape ,
89- pg_width = pg_width ,
90- pg_height = pg_height ,
91- margins = margins ,
92- lpp = lpp ,
93- cpp = cpp ,
94- colwidths = colwidths ,
95- tf_wrap = tf_wrap ,
96- max_width = max_width ,
97- rep_cols = length(get_keycols(lsting )),
98- verbose = verbose
99- )
78+ checkmate :: assert_flag(tf_wrap )
79+ checkmate :: assert_count(max_width , null.ok = TRUE )
80+ checkmate :: assert_flag(verbose )
81+ checkmate :: assert_class(lsting , " listing_df" )
82+ checkmate :: assert_numeric(colwidths , lower = 0 , len = length(listing_dispcols(lsting )), null.ok = TRUE )
10083
101- vert_pags <- lapply(
102- indx $ pag_row_indices ,
103- function (ii ) lsting [ii , ]
104- )
105- dispnames <- listing_dispcols(lsting )
106- full_pag <- lapply(
107- vert_pags ,
108- function (onepag ) {
109- if (! is.null(indx $ pag_col_indices )) {
110- lapply(
111- indx $ pag_col_indices ,
112- function (jj ) {
113- res <- onepag [, dispnames [jj ], drop = FALSE ]
114- listing_dispcols(res ) <- intersect(dispnames , names(res ))
115- res
116- }
117- )
118- } else {
119- list (onepag )
120- }
84+ indx <- paginate_indices(lsting ,
85+ page_type = page_type ,
86+ font_family = font_family ,
87+ font_size = font_size ,
88+ lineheight = lineheight ,
89+ landscape = landscape ,
90+ pg_width = pg_width ,
91+ pg_height = pg_height ,
92+ margins = margins ,
93+ lpp = lpp ,
94+ cpp = cpp ,
95+ colwidths = colwidths ,
96+ tf_wrap = tf_wrap ,
97+ max_width = max_width ,
98+ rep_cols = length(get_keycols(lsting )),
99+ verbose = verbose
100+ )
101+
102+ vert_pags <- lapply(
103+ indx $ pag_row_indices ,
104+ function (ii ) lsting [ii , ]
105+ )
106+ dispnames <- listing_dispcols(lsting )
107+ full_pag <- lapply(
108+ vert_pags ,
109+ function (onepag ) {
110+ if (! is.null(indx $ pag_col_indices )) {
111+ lapply(
112+ indx $ pag_col_indices ,
113+ function (jj ) {
114+ res <- onepag [, dispnames [jj ], drop = FALSE ]
115+ listing_dispcols(res ) <- intersect(dispnames , names(res ))
116+ res
117+ }
118+ )
119+ } else {
120+ list (onepag )
121121 }
122- )
122+ }
123+ )
123124
124- ret <- unlist(full_pag , recursive = FALSE )
125- ret
126- }
125+ ret <- unlist(full_pag , recursive = FALSE )
126+ ret
127127}
128128
129129# ' @title Defunct functions
0 commit comments