diff --git a/DESCRIPTION b/DESCRIPTION index 6fae07a1..62fc8399 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,20 +1,23 @@ Package: rlistings Title: Clinical Trial Style Data Readout Listings -Version: 0.2.0 +Version: 0.2.1 Date: 2023-03-01 Authors@R: c( person("Gabriel", "Becker", , "gabembecker@gmail.com", role = c("aut", "cre")), person("Adrian", "Waddell", , "adrian.waddell@gene.com", role = "aut"), person("Joe", "Zhu", , "joe.zhu@roche.com", role = "aut"), + person("Davide", "Garolini", , "davide.garolini@roche.com", role = "ctb"), + person("Emily", "de la Rua", , "emily.de_la_rua@contractors.roche.com", role = "ctb"), + person("Abinaya", "Yogasekaram", , "abinaya.yogasekaram@contractors.roche.com", role = "ctb"), person("F. Hoffmann-La Roche AG", role = c("cph", "fnd")) ) Description: Listings are often part of the submission of clinical trial data in regulatory settings. We provide a framework for the specific formatting features often used when displaying large datasets in that context. -License: Apache License 2.0 | file LICENSE -URL: http://github.com/insightsengineering/rlistings -BugReports: http://github.com/insightsengineering/rlistings/issues +License: Apache License 2.0 +URL: https://github.com/insightsengineering/rlistings +BugReports: https://github.com/insightsengineering/rlistings/issues Depends: formatters (>= 0.4.0), methods, diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 261eeb9e..00000000 --- a/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/NEWS.md b/NEWS.md index 89d8ca38..b362d812 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -## rlistings 0.2.0 +## rlistings 0.2.1 ### Enhancements * Extend page-size machinery in pagination by allowing the page specification (`page_type`, `pg_width`, diff --git a/R/paginate_listing.R b/R/paginate_listing.R index a485919e..d9a39005 100644 --- a/R/paginate_listing.R +++ b/R/paginate_listing.R @@ -23,7 +23,6 @@ #' @rdname paginate #' #' @examples -#' # Create a standard listing #' dat <- ex_adae #' lsting <- as_listing(dat[1:25, ], disp_cols = c("USUBJID", "AESOC", "RACE", "AETOXGR", "BMRKR1")) #' @@ -31,15 +30,17 @@ #' #' cat(toString(mat)) #' -#' # Vertical pagination #' paginate_listing(lsting, lpp = 10) #' -#' # Horizontal pagination #' paginate_listing(lsting, cpp = 100, lpp = 40) #' -#' # Use `verbose = TRUE` to display more descriptive warnings or errors -#' # paginate_listing(lsting, cpp = 80, lpp = 40, verbose = TRUE) +#' paginate_listing(lsting, cpp = 80, lpp = 40, verbose = TRUE) #' @export +#' +#' @return 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. paginate_listing <- function(lsting, page_type = "letter", font_family = "Courier", diff --git a/R/rlistings.R b/R/rlistings.R index 5bd3c892..68c8f3d4 100644 --- a/R/rlistings.R +++ b/R/rlistings.R @@ -175,11 +175,17 @@ get_keycols <- function(df) { } #' @export -#' @inheritParams formatters::matrix_form -#' @seealso [formatters::matrix_form()] This is partially inherited from `formatters`' function +#' @inherit formatters::matrix_form +#' @seealso [formatters::matrix_form()] #' @param indent_rownames logical(1). Silently ignored, as listings do not have row names #' nor indenting structure. -#' @rdname listings +#' +#' @examples +#' +#' lsting <- as_listing(mtcars) +#' mf <- matrix_form(lsting) +#' +#' @return a `MatrixPrintForm` object setMethod( "matrix_form", "listing_df", rix_form <- function(obj, indent_rownames = FALSE) { diff --git a/R/rlistings_methods.R b/R/rlistings_methods.R index 2bffcdb2..7364ab4d 100644 --- a/R/rlistings_methods.R +++ b/R/rlistings_methods.R @@ -38,7 +38,7 @@ basic_run_lens <- function(x) { } -#' @rdname listing_methods +#' @rdname vec_nlines #' @param df listing_df. The listing. #' @param colnm Column name #' @param colvec Column values based on colnm @@ -55,12 +55,21 @@ format_colvector <- function(df, colnm, colvec = df[[colnm]]) { strvec } -#' @rdname listing_methods -#' @param vec A vector. +#' Utilities for formatting a listing column +#' +#' For `vec_nlines`, calculate the number of lines each element of a column vector will +#' take to render. For `format_colvector`, +#' +#' @param vec any vector. A column vector to be rendered into ASCII. +#' @param max_width numeric (or NULL). The width the column will be +#' rendered in. +#' @return a numeric vector of the number of lines elementwise that +#' will be needed to render the elements of \code{vec} to width +#' \code{max_width}. #' @keywords internal setGeneric("vec_nlines", function(vec, max_width = NULL) standardGeneric("vec_nlines")) -#' @rdname listing_methods +#' @rdname vec_nlines #' @param vec A vector. #' @keywords internal setMethod("vec_nlines", "ANY", function(vec, max_width = NULL) { @@ -81,9 +90,19 @@ setMethod("vec_nlines", "ANY", function(vec, max_width = NULL) { ## ret[is.na(ret)] <- format_value(NA_character ## }) +#' Make pagination dataframe for a listing #' @export #' @inheritParams formatters::make_row_df -#' @rdname listing_methods +#' @param tt listing_df. The listing to be rendered +#' @param visible_only logical(1). Ignored, as listings +#' do not have non-visible structural elements. +#' +#' @examples +#' lsting <- as_listing(mtcars) +#' mf <- matrix_form(lsting) +#' +#' @return a data.frame with pagination information. +#' @seealso \code{\link[formatters]{make_row_df}} setMethod( "make_row_df", "listing_df", function(tt, colwidths = NULL, visible_only = TRUE, @@ -194,6 +213,7 @@ setMethod( #' @param j ANY. Passed to base `[` methods. #' @aliases [,listing_df-method #' @rdname listing_methods +#' @keywords internal setMethod( "[", "listing_df", function(x, i, j, drop = FALSE) { @@ -217,6 +237,12 @@ setMethod( #' header/body separator line. #' @param col_gap numeric(1). Space (in characters) between columns #' @exportMethod toString +#' +#' @examples +#' lsting <- as_listing(mtcars) +#' toString(lsting) +#' @return A character value containing the listing rendered into +#' ASCII text. setMethod("toString", "listing_df", function(x, widths = NULL, col_gap = 3, @@ -254,6 +280,16 @@ setMethod("toString", "listing_df", function(x, #' @rdname listing_methods #' @param obj The object. #' @export +#' @return for getter methods, the value of the aspect of +#' \code{obj}; for setter methods, \code{obj} with +#' the relevant element of the listing updated. +#' +#' @examples +#' +#' lsting <- as_listing(mtcars) +#' main_title(lsting) <- "Hi there" +#' +#' main_title(lsting) setMethod( "main_title", "listing_df", function(obj) attr(obj, "main_title") %||% character() diff --git a/inst/WORDLIST b/inst/WORDLIST index 1be5ae19..90d1e730 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -1,23 +1,68 @@ +Abinaya +abinaya ADAE -Forkers -Github -Hoffmann -MatrixPrintForm -README -Repo -WIP +adrian +aut +BugReports colnm +Config +cph cpp +cre csv +ctb customizations +Davide +davide +de df +dplyr droppage +emily +fnd +Forkers formatter formatters funder +gabembecker +Garolini +garolini +getter +Github +github +gmail +grDevices +Hoffmann +https +insightsengineering +joe +knitr +lifecycle lpp +MatrixPrintForm +nesttemplate pagesize pre +README +Repo repo +rlistings +roche +Roxygen +RoxygenNote +rtable +rtables +Rua +rua subtable +testthat +tibble toString +VignetteBuilder +Waddell +waddell +WIP +Yogasekaram +yogasekaram +Zhu +zhu diff --git a/man/listing_methods.Rd b/man/listing_methods.Rd index 447e5549..6f61f925 100644 --- a/man/listing_methods.Rd +++ b/man/listing_methods.Rd @@ -3,10 +3,6 @@ \name{listing_methods} \alias{listing_methods} \alias{print.listing_df} -\alias{format_colvector} -\alias{vec_nlines} -\alias{vec_nlines,ANY-method} -\alias{make_row_df,listing_df-method} \alias{[,listing_df-method} \alias{main_title,listing_df-method} \alias{subtitles,listing_df-method} @@ -20,26 +16,6 @@ \usage{ \method{print}{listing_df}(x, ...) -format_colvector(df, colnm, colvec = df[[colnm]]) - -vec_nlines(vec, max_width = NULL) - -\S4method{vec_nlines}{ANY}(vec, max_width = NULL) - -\S4method{make_row_df}{listing_df}( - tt, - colwidths = NULL, - visible_only = TRUE, - rownum = 0, - indent = 0L, - path = character(), - incontent = FALSE, - repr_ext = 0L, - repr_inds = integer(), - sibpos = NA_integer_, - nsibs = NA_integer_ -) - \S4method{[}{listing_df}(x, i, j, drop = FALSE) \S4method{main_title}{listing_df}(obj) @@ -63,41 +39,6 @@ vec_nlines(vec, max_width = NULL) \item{...}{dots. Unused} -\item{df}{listing_df. The listing.} - -\item{colnm}{Column name} - -\item{colvec}{Column values based on colnm} - -\item{vec}{A vector.} - -\item{max_width}{numeric(1) or NULL. Maximum width for title/footer -materials.} - -\item{tt}{ANY. Object representing the table-like object to be summarized.} - -\item{colwidths}{numeric. Internal detail do not set manually.} - -\item{visible_only}{logical(1). Should only visible aspects of the table structure be reflected in this summary. -Defaults to \code{TRUE}. May not be supported by all methods.} - -\item{rownum}{numeric(1). Internal detail do not set manually.} - -\item{indent}{integer(1). Internal detail do not set manually.} - -\item{path}{character. Path to the (sub)table represented by -\code{tt}. Defaults to \code{character()}} - -\item{incontent}{logical(1). Internal detail do not set manually.} - -\item{repr_ext}{integer(1). Internal detail do not set manually.} - -\item{repr_inds}{integer. Internal detail do not set manually.} - -\item{sibpos}{integer(1). Internal detail do not set manually.} - -\item{nsibs}{integer(1). Internal detail do not set manually.} - \item{i}{ANY. Passed to base \code{[} methods.} \item{j}{ANY. Passed to base \code{[} methods.} @@ -113,8 +54,20 @@ Defaults to \code{TRUE}. May not be supported by all methods.} \item{value}{typically an array-like \R object of a similar class as \code{x}.} } +\value{ +for getter methods, the value of the aspect of +\code{obj}; for setter methods, \code{obj} with +the relevant element of the listing updated. +} \description{ See core documentation in \code{formatters} for descriptions of these functions. } +\examples{ + +lsting <- as_listing(mtcars) +main_title(lsting) <- "Hi there" + +main_title(lsting) +} \keyword{internal} diff --git a/man/listings.Rd b/man/listings.Rd index 2ddac5fa..e431e649 100644 --- a/man/listings.Rd +++ b/man/listings.Rd @@ -5,7 +5,6 @@ \alias{as_keycol} \alias{is_keycol} \alias{get_keycols} -\alias{matrix_form,listing_df-method} \alias{listing_dispcols} \alias{add_listing_dispcol} \alias{listing_dispcols<-} @@ -29,8 +28,6 @@ is_keycol(vec) get_keycols(df) -\S4method{matrix_form}{listing_df}(obj, indent_rownames = FALSE) - listing_dispcols(df) add_listing_dispcol(df, new) @@ -68,11 +65,6 @@ for the listing, or \code{NULL} (the default). Each string element is placed on \item{vec}{any. A column vector from a \code{listing_df} to be annotated as a key column.} -\item{obj}{ANY. Object to be transformed into a ready-to-render form (a MatrixPrintForm object)} - -\item{indent_rownames}{logical(1). Silently ignored, as listings do not have row names -nor indenting structure.} - \item{new}{character. Names of columns to be added to the set of display columns.} @@ -166,6 +158,3 @@ mat <- matrix_form(lsting) cat(toString(mat)) } -\seealso{ -\code{\link[formatters:matrix_form]{formatters::matrix_form()}} This is partially inherited from \code{formatters}' function -} diff --git a/man/make_row_df-listing_df-method.Rd b/man/make_row_df-listing_df-method.Rd new file mode 100644 index 00000000..cdc2183f --- /dev/null +++ b/man/make_row_df-listing_df-method.Rd @@ -0,0 +1,59 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/rlistings_methods.R +\name{make_row_df,listing_df-method} +\alias{make_row_df,listing_df-method} +\title{Make pagination dataframe for a listing} +\usage{ +\S4method{make_row_df}{listing_df}( + tt, + colwidths = NULL, + visible_only = TRUE, + rownum = 0, + indent = 0L, + path = character(), + incontent = FALSE, + repr_ext = 0L, + repr_inds = integer(), + sibpos = NA_integer_, + nsibs = NA_integer_ +) +} +\arguments{ +\item{tt}{listing_df. The listing to be rendered} + +\item{colwidths}{numeric. Internal detail do not set manually.} + +\item{visible_only}{logical(1). Ignored, as listings +do not have non-visible structural elements.} + +\item{rownum}{numeric(1). Internal detail do not set manually.} + +\item{indent}{integer(1). Internal detail do not set manually.} + +\item{path}{character. Path to the (sub)table represented by +\code{tt}. Defaults to \code{character()}} + +\item{incontent}{logical(1). Internal detail do not set manually.} + +\item{repr_ext}{integer(1). Internal detail do not set manually.} + +\item{repr_inds}{integer. Internal detail do not set manually.} + +\item{sibpos}{integer(1). Internal detail do not set manually.} + +\item{nsibs}{integer(1). Internal detail do not set manually.} +} +\value{ +a data.frame with pagination information. +} +\description{ +Make pagination dataframe for a listing +} +\examples{ +lsting <- as_listing(mtcars) +mf <- matrix_form(lsting) + +} +\seealso{ +\code{\link[formatters]{make_row_df}} +} diff --git a/man/matrix_form-listing_df-method.Rd b/man/matrix_form-listing_df-method.Rd new file mode 100644 index 00000000..11f51d69 --- /dev/null +++ b/man/matrix_form-listing_df-method.Rd @@ -0,0 +1,35 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/rlistings.R +\name{matrix_form,listing_df-method} +\alias{matrix_form,listing_df-method} +\title{Transform rtable to a list of matrices which can be used for outputting} +\usage{ +\S4method{matrix_form}{listing_df}(obj, indent_rownames = FALSE) +} +\arguments{ +\item{obj}{ANY. Object to be transformed into a ready-to-render form (a MatrixPrintForm object)} + +\item{indent_rownames}{logical(1). Silently ignored, as listings do not have row names +nor indenting structure.} +} +\value{ +a \code{MatrixPrintForm} object +} +\description{ +Although rtables are represented as a tree data structure when outputting the table to ASCII or HTML it is useful to +map the rtable to an in between state with the formatted cells in a matrix form. +} +\details{ +The strings in the return object are defined as follows: row labels are those determined by \code{summarize_rows} and +cell values are determined using \code{get_formatted_cells}. +(Column labels are calculated using a non-exported internal function. +} +\examples{ + +lsting <- as_listing(mtcars) +mf <- matrix_form(lsting) + +} +\seealso{ +\code{\link[formatters:matrix_form]{formatters::matrix_form()}} +} diff --git a/man/paginate.Rd b/man/paginate.Rd index 46ff2f79..545a6eb9 100644 --- a/man/paginate.Rd +++ b/man/paginate.Rd @@ -86,6 +86,11 @@ pagination breaks be shown. Defaults to \code{FALSE}.} \value{ A list of listings' objects that are meant to be on separated pages. For \code{pag_tt_indices} a list of paginated-groups of row-indices of \code{lsting}. + +for \code{paginate_listing} a list containing separate +\code{listing_df} objects for each page, for \code{pag_listing_indices}, +a list of indices in the direction being paginated corresponding +to the individual pages in that dimension. } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} @@ -94,7 +99,6 @@ Pagination of a listing. This can be vertical for long listings with many rows or horizontal if there are many columns. } \examples{ -# Create a standard listing dat <- ex_adae lsting <- as_listing(dat[1:25, ], disp_cols = c("USUBJID", "AESOC", "RACE", "AETOXGR", "BMRKR1")) @@ -102,12 +106,9 @@ mat <- matrix_form(lsting) cat(toString(mat)) -# Vertical pagination paginate_listing(lsting, lpp = 10) -# Horizontal pagination paginate_listing(lsting, cpp = 100, lpp = 40) -# Use `verbose = TRUE` to display more descriptive warnings or errors -# paginate_listing(lsting, cpp = 80, lpp = 40, verbose = TRUE) +paginate_listing(lsting, cpp = 80, lpp = 40, verbose = TRUE) } diff --git a/man/rlistings-package.Rd b/man/rlistings-package.Rd index dc91265a..3fb1a53d 100644 --- a/man/rlistings-package.Rd +++ b/man/rlistings-package.Rd @@ -11,8 +11,8 @@ Listings are often part of the submission of clinical trial data in regulatory s \seealso{ Useful links: \itemize{ - \item \url{http://github.com/insightsengineering/rlistings} - \item Report bugs at \url{http://github.com/insightsengineering/rlistings/issues} + \item \url{https://github.com/insightsengineering/rlistings} + \item Report bugs at \url{https://github.com/insightsengineering/rlistings/issues} } } @@ -27,6 +27,9 @@ Authors: Other contributors: \itemize{ + \item Davide Garolini \email{davide.garolini@roche.com} [contributor] + \item Emily de la Rua \email{emily.de_la_rua@contractors.roche.com} [contributor] + \item Abinaya Yogasekaram \email{abinaya.yogasekaram@contractors.roche.com} [contributor] \item F. Hoffmann-La Roche AG [copyright holder, funder] } diff --git a/man/toString-listing_df-method.Rd b/man/toString-listing_df-method.Rd index c9d34b0e..3283fd81 100644 --- a/man/toString-listing_df-method.Rd +++ b/man/toString-listing_df-method.Rd @@ -19,6 +19,14 @@ also be considered.} \item{hsep}{character(1). Characters to repeat to create header/body separator line.} } +\value{ +A character value containing the listing rendered into +ASCII text. +} \description{ toString method for listing_df object } +\examples{ +lsting <- as_listing(mtcars) +toString(lsting) +} diff --git a/man/vec_nlines.Rd b/man/vec_nlines.Rd new file mode 100644 index 00000000..810bbcc1 --- /dev/null +++ b/man/vec_nlines.Rd @@ -0,0 +1,36 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/rlistings_methods.R +\name{format_colvector} +\alias{format_colvector} +\alias{vec_nlines} +\alias{vec_nlines,ANY-method} +\title{Utilities for formatting a listing column} +\usage{ +format_colvector(df, colnm, colvec = df[[colnm]]) + +vec_nlines(vec, max_width = NULL) + +\S4method{vec_nlines}{ANY}(vec, max_width = NULL) +} +\arguments{ +\item{df}{listing_df. The listing.} + +\item{colnm}{Column name} + +\item{colvec}{Column values based on colnm} + +\item{vec}{A vector.} + +\item{max_width}{numeric (or NULL). The width the column will be +rendered in.} +} +\value{ +a numeric vector of the number of lines elementwise that +will be needed to render the elements of \code{vec} to width +\code{max_width}. +} +\description{ +For \code{vec_nlines}, calculate the number of lines each element of a column vector will +take to render. For \code{format_colvector}, +} +\keyword{internal} diff --git a/vignettes/rlistings.Rmd b/vignettes/rlistings.Rmd index 906740a3..22b9feb8 100644 --- a/vignettes/rlistings.Rmd +++ b/vignettes/rlistings.Rmd @@ -32,16 +32,16 @@ knitr::opts_chunk$set( This vignette shows the general purpose and basic functionality of the `rlistings` R package. The `rlistings` R package contains value formatting and ASCII rendering infrastructure for tables and listings useful for clinical trials and other statistical analysis. -The core functionality is built on top of the [`formatters` package](https://insightsengineering.github.io/formatters/). +The core functionality is built on top of the [`formatters` package](https://insightsengineering.github.io/formatters/latest-tag/). Some of the key features currently available to customize listings created using the `rlistings` package include: - Key columns - Titles and footnotes -The index of all available `rlistings` functions can be found on the [rlistings website functions reference](https://insightsengineering.github.io/rlistings/reference/index.html). +The index of all available `rlistings` functions can be found on the [rlistings website functions reference](https://insightsengineering.github.io/rlistings/main/reference/index.html). -The `rlistings` package is intended for use in creating simple one-dimensional listings. For construction of more complex tables see the [`rtables` package](https://roche.github.io/rtables/). +The `rlistings` package is intended for use in creating simple one-dimensional listings. For construction of more complex tables see the [`rtables` package](https://insightsengineering.github.io/rtables/). --------- @@ -180,4 +180,4 @@ head(lsting, 15) In this vignette you have learned how to implement the basic listing framework provided by the `rlistings` package to build a simple listing. You have also seen examples demonstrating how the optional parameters of the `as_listing` function can be set to customize and annotate your listings. -**For more information please explore the [rlistings website](https://insightsengineering.github.io/rlistings/).** +**For more information please explore the [rlistings website](https://insightsengineering.github.io/rlistings/main/).**