Skip to content

Commit 986d8b9

Browse files
authored
Merge pull request #3 from humanpred/release
Prepare for release
2 parents 30246d3 + cde2aee commit 986d8b9

16 files changed

+99
-50
lines changed

.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
^pkgdown$
77
^\.github$
88
^LICENSE\.md$
9+
^CRAN-SUBMISSION$

CRAN-SUBMISSION

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Version: 0.0.1
2+
Date: 2025-03-09 14:29:52 UTC
3+
SHA: fed8917e5216252c01ee4ff97e4454d7b2f763a7

DESCRIPTION

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
Package: tabtibble
22
Title: Simplify Reporting Many Tables
3-
Version: 0.0.0.9000
3+
Version: 0.0.1
44
Authors@R:
55
person("Bill", "Denney", email="wdenney@humanpredictions.com", role=c("aut", "cre"), comment=c(ORCID="0000-0002-5759-428X"))
6-
Description: What the package does (one paragraph).
6+
Description: Simplify reporting many tables by creating tibbles of tables. With
7+
'tabtibble', a tibble of tables is created with captions and automatic
8+
printing using 'knit_print()'.
79
License: GPL (>= 3)
810
Encoding: UTF-8
911
Roxygen: list(markdown = TRUE)
@@ -16,10 +18,12 @@ Suggests:
1618
glue,
1719
pander,
1820
rmarkdown,
21+
spelling,
1922
testthat (>= 3.0.0),
2023
tibble,
2124
tidyr
2225
Config/testthat/edition: 3
2326
URL: https://github.com/humanpred/tabtibble, https://humanpred.github.io/tabtibble/
2427
BugReports: https://github.com/humanpred/tabtibble/issues
2528
VignetteBuilder: knitr
29+
Language: en-US

NAMESPACE

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ S3method(format,tab_list)
44
S3method(knit_print,tab_list)
55
S3method(knit_print,tab_tibble)
66
S3method(print,tab_list)
7+
S3method(print_tabtibble,default)
78
S3method(vctrs::vec_ptype_abbr,tab_list)
89
export(knit_print)
910
export(new_tab_list)
1011
export(new_tab_tibble)
11-
export(print_tablist_pander)
12+
export(print_tabtibble)
1213
importFrom(knitr,knit_print)

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# tabtibble 0.0.1
2+
3+
* Initial CRAN submission.

R/knit_print.R

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,33 @@ knit_print.tab_tibble <- function(x, ...) {
1616

1717
#' Print a tab_list
1818
#'
19+
#' @details
20+
#' Individual tables are printed with the `print_tabtibble()` S3 generic
21+
#' function.
22+
#'
23+
#'
1924
#' @param x The `tab_list` object to print
2025
#' @param ... passed to `print_fun`
2126
#' @param caption The caption for each table as a character vector
22-
#' @param print_fun A function taking arguments of `x` (one data.frame to
27+
#' @param print_fun Override the default printing using `print_tabtibble`. If
28+
#' provided it is a function taking arguments of `x` (one data.frame to
2329
#' print), `caption` (the caption for that data.frame), and `...`.
2430
#' @param tab_prefix,tab_suffix Any text to add before/after each figure (`NULL`
2531
#' to omit)
2632
#' @returns `x` invisibly
2733
#' @family knitters
2834
#' @export
29-
knit_print.tab_list <- function(x, ..., caption, print_fun = print_tablist_pander, tab_prefix = NULL, tab_suffix = "\n\n") {
35+
knit_print.tab_list <- function(x, ..., caption, print_fun = NULL, tab_prefix = NULL, tab_suffix = "\n\n") {
3036
stopifnot(length(x) == length(caption))
3137
for (idx in seq_along(x)) {
3238
if (!is.null(tab_prefix)) {
3339
cat(tab_prefix)
3440
}
35-
print_fun(x = x[[idx]], caption = caption[[idx]], ...)
41+
if (is.null(print_fun)) {
42+
print_tabtibble(x = x[[idx]], caption = caption[[idx]], ...)
43+
} else {
44+
print_fun(x = x[[idx]], caption = caption[[idx]], ...)
45+
}
3646
if (!is.null(tab_suffix)) {
3747
cat(tab_suffix)
3848
}

R/objects.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ vec_ptype_abbr.tab_list <- function(x, ...) {
3434

3535
#' @export
3636
format.tab_list <- function(x, ...) {
37-
sprintf("A %s object", vapply(X = x, FUN = \(x) class(x)[1], FUN.VALUE = ""))
37+
sprintf("A %s object", vapply(X = x, FUN = function(x) class(x)[1], FUN.VALUE = ""))
3838
}
3939

4040
#' @export

R/tablist_printers.R

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
1-
#' Print a tablist using `pander::pander()`
1+
#' Print a single table from a tablist
2+
#'
23
#' @param x A table to print
34
#' @param caption The caption for the table
5+
#' @param ... Passed to subsequent methods
6+
#' @export
7+
print_tabtibble <- function(x, caption, ...) {
8+
UseMethod("print_tabtibble")
9+
}
10+
11+
#' @describeIn print_tabtibble Print a single table from a tablist using `pander::pander()`
412
#' @param ... Passed to `pander::pander`
513
#' @returns The result of `pander::pander`
614
#' @export
7-
print_tablist_pander <- function(x, caption, ...) {
15+
print_tabtibble.default <- function(x, caption, ...) {
816
auto_asis_start <- pander::panderOptions("knitr.auto.asis")
917
on.exit(pander::panderOptions("knitr.auto.asis", auto_asis_start))
1018
pander::panderOptions("knitr.auto.asis", FALSE)

inst/WORDLIST

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
CMD
2+
Codecov
3+
tablist
4+
tibble

man/knit_print.tab_list.Rd

Lines changed: 7 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)