Skip to content

Commit

Permalink
[skip vbump] Internal release candidate 0.5.3 (#204)
Browse files Browse the repository at this point in the history
Achieves #200

---------

Signed-off-by: Davide Garolini <[email protected]>
Co-authored-by: ayogasekaram <[email protected]>
  • Loading branch information
Melkiades and ayogasekaram authored Oct 3, 2023
1 parent 723f2fc commit 062b0ba
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 14 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: formatters
Title: ASCII Formatting for Values and Tables
Version: 0.5.2.9003
Version: 0.5.3
Date: 2023-09-14
Authors@R: c(
person("Gabriel", "Becker", , "[email protected]", role = "aut",
Expand Down
7 changes: 3 additions & 4 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
## formatters 0.5.2.9003
* Specified minimal version of package dependencies.

### Miscellaneous
## formatters 0.5.3
* Decimal alignment now throws informative error if scientific notation is used.
* Specified minimal version of package dependencies.
* Updated hex sticker logo.

## formatters 0.5.2
* `paginate_to_mpfs` can handle single column tables and listings.
Expand Down
33 changes: 27 additions & 6 deletions R/generics.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@

#' @import methods
#' @include matrix_form.R

#' @title Make row and column layout summary data.frames for use during pagination
#' @name make_row_df
#'
#' @title Make row layout summary data.frames for use during pagination
#'
#' @description
#' All relevant information about table rows (e.g. indentations) is summarized in a data.frames.
#' This function works ONLY on `rtables` and `rlistings` objects, and not on their print counterparts
#' (like `MatrixPrintForm`).
#'
#' @name make_row_df
#'
#' @param tt ANY. Object representing the table-like object to be summarized.
#' @param visible_only logical(1). Should only visible aspects of the table structure be reflected in this summary.
Expand Down Expand Up @@ -46,12 +51,12 @@
#' and should not be set during a top-level call
#'
#' @note the technically present root tree node is excluded from the summary returned by
#' both \code{make_row_df} and \code{make_col_df}, as it is simply the
#' both \code{make_row_df} and \code{make_col_df} (see `rtables::make_col_df`), as it is simply the
#' row/column structure of \code{tt} and thus not useful for pathing or pagination.
#' @export
#' @return a data.frame of row/column-structure information used by the pagination machinery.
#' @rdname make_row_df
#'
#' @rdname make_row_df
#' @export
## nocov start
setGeneric("make_row_df", function(tt, colwidths = NULL, visible_only = TRUE,
rownum = 0,
Expand All @@ -65,6 +70,21 @@ setGeneric("make_row_df", function(tt, colwidths = NULL, visible_only = TRUE,
max_width = NULL) {
standardGeneric("make_row_df")
})

#' @rdname make_row_df
setMethod("make_row_df", "MatrixPrintForm", function(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_,
max_width = NULL) {
stop("make_row_df can be used only on {rtables} table objects, and not on `matrix_form`-",
"generated objects (MatrixPrintForm).")
})
## nocov end


Expand Down Expand Up @@ -109,6 +129,7 @@ setGeneric("matrix_form", function(obj,
standardGeneric("matrix_form")
})


#' @rdname matrix_form
#' @export
setMethod("matrix_form", "MatrixPrintForm", function(obj,
Expand Down
Binary file removed man/figures/formatters_hexSticker.pdf
Binary file not shown.
Binary file modified man/figures/formatters_hexSticker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 21 additions & 3 deletions man/make_row_df.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions tests/testthat/test-formatters.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
values <- c(5.123456, 7.891112)
test_that("Default hsep works", {
expect_true(default_hsep() %in% c("\u2014", "-"))
})
test_that("make_row_df produces custom error message if used on MatrixPrintForm", {
# To cover generic that does use {rtables} obj (no circular deps)
expect_error(
make_row_df(basic_matrix_form(iris)),
"MatrixPrintForm"
)
})
test_that("formats work", {
## listing supported formats and enuring they all read as valid
forms <- list_valid_format_labels()
Expand Down

0 comments on commit 062b0ba

Please sign in to comment.