From a075c7f23f070acb94c100529a92beede1526597 Mon Sep 17 00:00:00 2001 From: Richard Iannone Date: Fri, 28 Jan 2022 10:56:28 -0500 Subject: [PATCH 01/11] Update _pkgdown.yml --- _pkgdown.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/_pkgdown.yml b/_pkgdown.yml index 11652e20e..557e0e706 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -1,8 +1,13 @@ -url: https://gt.rstudio.com +destination: docs home: strip_header: true +url: https://gt.rstudio.com + +template: + bootstrap: 5 + reference: - title: Create Table desc: > @@ -71,7 +76,7 @@ reference: columns. This includes alignment of the data in columns (`cols_align()`), hiding columns from view (`cols_hide()`), re-labeling the column labels (`cols_label()`), merging two columns - together (`cols_merge*()`), moving columns around (`cols_move*()`) + together (`cols_merge*()`), moving columns around (`cols_move*()`). contents: - cols_align - cols_width From ea358fd7c869497c4e003ea355cefb3e63425008 Mon Sep 17 00:00:00 2001 From: Richard Iannone Date: Fri, 28 Jan 2022 10:57:05 -0500 Subject: [PATCH 02/11] Make corrections to docs (`columns`/`rows`) --- R/format_data.R | 6 +++--- R/modify_columns.R | 6 +++--- man/cols_width.Rd | 6 +++--- man/fmt.Rd | 6 +++--- man/fmt_bytes.Rd | 6 +++--- man/fmt_currency.Rd | 6 +++--- man/fmt_date.Rd | 6 +++--- man/fmt_datetime.Rd | 6 +++--- man/fmt_engineering.Rd | 6 +++--- man/fmt_integer.Rd | 6 +++--- man/fmt_markdown.Rd | 6 +++--- man/fmt_missing.Rd | 6 +++--- man/fmt_number.Rd | 6 +++--- man/fmt_passthrough.Rd | 6 +++--- man/fmt_percent.Rd | 6 +++--- man/fmt_scientific.Rd | 6 +++--- man/fmt_time.Rd | 6 +++--- 17 files changed, 51 insertions(+), 51 deletions(-) diff --git a/R/format_data.R b/R/format_data.R index 03526fc22..86ddabad8 100644 --- a/R/format_data.R +++ b/R/format_data.R @@ -30,9 +30,9 @@ #' focused on selections. The select helper functions are: [starts_with()], #' [ends_with()], [contains()], [matches()], [one_of()], [num_range()], and #' [everything()]. -#' @param rows Optional rows to format. Providing either [everything()] (the -#' default) or `TRUE` results in all rows in `columns` being formatted. Can -#' either be a vector of row captions provided in [c()], a vector of row +#' @param rows Optional rows to format. Providing [everything()] (the +#' default) results in all rows in `columns` being formatted. Alternatively, +#' we can supply a vector of row captions within [c()], a vector of row #' indices, or a helper function focused on selections. The select helper #' functions are: [starts_with()], [ends_with()], [contains()], [matches()], #' [one_of()], [num_range()], and [everything()]. We can also use expressions diff --git a/R/modify_columns.R b/R/modify_columns.R index b336830a6..a8dad3740 100644 --- a/R/modify_columns.R +++ b/R/modify_columns.R @@ -146,7 +146,7 @@ cols_align <- function(data, #' Subsequent expressions that operate on the columns assigned previously will #' result in overwriting column width values (both in the same `cols_width()` #' call and across separate calls). All other columns can be assigned a -#' default width value by using `TRUE` or `everything()` on the left-hand +#' default width value by using `everything()` on the left-hand #' side. #' @param .list Allows for the use of a list as an input alternative to `...`. #' @@ -157,8 +157,8 @@ cols_align <- function(data, #' # with named arguments in `...`, we #' # can specify the exact widths for #' # table columns (using `everything()` -#' # or `TRUE` at the end will capture -#' # all remaining columns) +#' # at the end will capture all +#' # remaining columns) #' tab_1 <- #' exibble %>% #' dplyr::select( diff --git a/man/cols_width.Rd b/man/cols_width.Rd index 19ea646ba..8beda6cd1 100644 --- a/man/cols_width.Rd +++ b/man/cols_width.Rd @@ -20,7 +20,7 @@ column-based select helpers \code{\link[=starts_with]{starts_with()}}, \code{\li Subsequent expressions that operate on the columns assigned previously will result in overwriting column width values (both in the same \code{cols_width()} call and across separate calls). All other columns can be assigned a -default width value by using \code{TRUE} or \code{everything()} on the left-hand +default width value by using \code{everything()} on the left-hand side.} \item{.list}{Allows for the use of a list as an input alternative to \code{...}.} @@ -61,8 +61,8 @@ and \code{container.width} arguments within \code{\link[=tab_options]{tab_option # with named arguments in `...`, we # can specify the exact widths for # table columns (using `everything()` -# or `TRUE` at the end will capture -# all remaining columns) +# at the end will capture all +# remaining columns) tab_1 <- exibble \%>\% dplyr::select( diff --git a/man/fmt.Rd b/man/fmt.Rd index 6996a1f89..cade84ac5 100644 --- a/man/fmt.Rd +++ b/man/fmt.Rd @@ -15,9 +15,9 @@ focused on selections. The select helper functions are: \code{\link[=starts_with \code{\link[=ends_with]{ends_with()}}, \code{\link[=contains]{contains()}}, \code{\link[=matches]{matches()}}, \code{\link[=one_of]{one_of()}}, \code{\link[=num_range]{num_range()}}, and \code{\link[=everything]{everything()}}.} -\item{rows}{Optional rows to format. Providing either \code{\link[=everything]{everything()}} (the -default) or \code{TRUE} results in all rows in \code{columns} being formatted. Can -either be a vector of row captions provided in \code{\link[=c]{c()}}, a vector of row +\item{rows}{Optional rows to format. Providing \code{\link[=everything]{everything()}} (the +default) results in all rows in \code{columns} being formatted. Alternatively, +we can supply a vector of row captions within \code{\link[=c]{c()}}, a vector of row indices, or a helper function focused on selections. The select helper functions are: \code{\link[=starts_with]{starts_with()}}, \code{\link[=ends_with]{ends_with()}}, \code{\link[=contains]{contains()}}, \code{\link[=matches]{matches()}}, \code{\link[=one_of]{one_of()}}, \code{\link[=num_range]{num_range()}}, and \code{\link[=everything]{everything()}}. We can also use expressions diff --git a/man/fmt_bytes.Rd b/man/fmt_bytes.Rd index 7182cbcf8..3fe89e981 100644 --- a/man/fmt_bytes.Rd +++ b/man/fmt_bytes.Rd @@ -31,9 +31,9 @@ focused on selections. The select helper functions are: \code{\link[=starts_with \code{\link[=ends_with]{ends_with()}}, \code{\link[=contains]{contains()}}, \code{\link[=matches]{matches()}}, \code{\link[=one_of]{one_of()}}, \code{\link[=num_range]{num_range()}}, and \code{\link[=everything]{everything()}}.} -\item{rows}{Optional rows to format. Providing either \code{\link[=everything]{everything()}} (the -default) or \code{TRUE} results in all rows in \code{columns} being formatted. Can -either be a vector of row captions provided in \code{\link[=c]{c()}}, a vector of row +\item{rows}{Optional rows to format. Providing \code{\link[=everything]{everything()}} (the +default) results in all rows in \code{columns} being formatted. Alternatively, +we can supply a vector of row captions within \code{\link[=c]{c()}}, a vector of row indices, or a helper function focused on selections. The select helper functions are: \code{\link[=starts_with]{starts_with()}}, \code{\link[=ends_with]{ends_with()}}, \code{\link[=contains]{contains()}}, \code{\link[=matches]{matches()}}, \code{\link[=one_of]{one_of()}}, \code{\link[=num_range]{num_range()}}, and \code{\link[=everything]{everything()}}. We can also use expressions diff --git a/man/fmt_currency.Rd b/man/fmt_currency.Rd index 3b3a99854..fb2df1c38 100644 --- a/man/fmt_currency.Rd +++ b/man/fmt_currency.Rd @@ -34,9 +34,9 @@ focused on selections. The select helper functions are: \code{\link[=starts_with \code{\link[=ends_with]{ends_with()}}, \code{\link[=contains]{contains()}}, \code{\link[=matches]{matches()}}, \code{\link[=one_of]{one_of()}}, \code{\link[=num_range]{num_range()}}, and \code{\link[=everything]{everything()}}.} -\item{rows}{Optional rows to format. Providing either \code{\link[=everything]{everything()}} (the -default) or \code{TRUE} results in all rows in \code{columns} being formatted. Can -either be a vector of row captions provided in \code{\link[=c]{c()}}, a vector of row +\item{rows}{Optional rows to format. Providing \code{\link[=everything]{everything()}} (the +default) results in all rows in \code{columns} being formatted. Alternatively, +we can supply a vector of row captions within \code{\link[=c]{c()}}, a vector of row indices, or a helper function focused on selections. The select helper functions are: \code{\link[=starts_with]{starts_with()}}, \code{\link[=ends_with]{ends_with()}}, \code{\link[=contains]{contains()}}, \code{\link[=matches]{matches()}}, \code{\link[=one_of]{one_of()}}, \code{\link[=num_range]{num_range()}}, and \code{\link[=everything]{everything()}}. We can also use expressions diff --git a/man/fmt_date.Rd b/man/fmt_date.Rd index 6aee0ac89..f5d0088bc 100644 --- a/man/fmt_date.Rd +++ b/man/fmt_date.Rd @@ -15,9 +15,9 @@ focused on selections. The select helper functions are: \code{\link[=starts_with \code{\link[=ends_with]{ends_with()}}, \code{\link[=contains]{contains()}}, \code{\link[=matches]{matches()}}, \code{\link[=one_of]{one_of()}}, \code{\link[=num_range]{num_range()}}, and \code{\link[=everything]{everything()}}.} -\item{rows}{Optional rows to format. Providing either \code{\link[=everything]{everything()}} (the -default) or \code{TRUE} results in all rows in \code{columns} being formatted. Can -either be a vector of row captions provided in \code{\link[=c]{c()}}, a vector of row +\item{rows}{Optional rows to format. Providing \code{\link[=everything]{everything()}} (the +default) results in all rows in \code{columns} being formatted. Alternatively, +we can supply a vector of row captions within \code{\link[=c]{c()}}, a vector of row indices, or a helper function focused on selections. The select helper functions are: \code{\link[=starts_with]{starts_with()}}, \code{\link[=ends_with]{ends_with()}}, \code{\link[=contains]{contains()}}, \code{\link[=matches]{matches()}}, \code{\link[=one_of]{one_of()}}, \code{\link[=num_range]{num_range()}}, and \code{\link[=everything]{everything()}}. We can also use expressions diff --git a/man/fmt_datetime.Rd b/man/fmt_datetime.Rd index df756dea2..8023eb017 100644 --- a/man/fmt_datetime.Rd +++ b/man/fmt_datetime.Rd @@ -21,9 +21,9 @@ focused on selections. The select helper functions are: \code{\link[=starts_with \code{\link[=ends_with]{ends_with()}}, \code{\link[=contains]{contains()}}, \code{\link[=matches]{matches()}}, \code{\link[=one_of]{one_of()}}, \code{\link[=num_range]{num_range()}}, and \code{\link[=everything]{everything()}}.} -\item{rows}{Optional rows to format. Providing either \code{\link[=everything]{everything()}} (the -default) or \code{TRUE} results in all rows in \code{columns} being formatted. Can -either be a vector of row captions provided in \code{\link[=c]{c()}}, a vector of row +\item{rows}{Optional rows to format. Providing \code{\link[=everything]{everything()}} (the +default) results in all rows in \code{columns} being formatted. Alternatively, +we can supply a vector of row captions within \code{\link[=c]{c()}}, a vector of row indices, or a helper function focused on selections. The select helper functions are: \code{\link[=starts_with]{starts_with()}}, \code{\link[=ends_with]{ends_with()}}, \code{\link[=contains]{contains()}}, \code{\link[=matches]{matches()}}, \code{\link[=one_of]{one_of()}}, \code{\link[=num_range]{num_range()}}, and \code{\link[=everything]{everything()}}. We can also use expressions diff --git a/man/fmt_engineering.Rd b/man/fmt_engineering.Rd index d2c7a4e5d..a2cabbc9d 100644 --- a/man/fmt_engineering.Rd +++ b/man/fmt_engineering.Rd @@ -27,9 +27,9 @@ focused on selections. The select helper functions are: \code{\link[=starts_with \code{\link[=ends_with]{ends_with()}}, \code{\link[=contains]{contains()}}, \code{\link[=matches]{matches()}}, \code{\link[=one_of]{one_of()}}, \code{\link[=num_range]{num_range()}}, and \code{\link[=everything]{everything()}}.} -\item{rows}{Optional rows to format. Providing either \code{\link[=everything]{everything()}} (the -default) or \code{TRUE} results in all rows in \code{columns} being formatted. Can -either be a vector of row captions provided in \code{\link[=c]{c()}}, a vector of row +\item{rows}{Optional rows to format. Providing \code{\link[=everything]{everything()}} (the +default) results in all rows in \code{columns} being formatted. Alternatively, +we can supply a vector of row captions within \code{\link[=c]{c()}}, a vector of row indices, or a helper function focused on selections. The select helper functions are: \code{\link[=starts_with]{starts_with()}}, \code{\link[=ends_with]{ends_with()}}, \code{\link[=contains]{contains()}}, \code{\link[=matches]{matches()}}, \code{\link[=one_of]{one_of()}}, \code{\link[=num_range]{num_range()}}, and \code{\link[=everything]{everything()}}. We can also use expressions diff --git a/man/fmt_integer.Rd b/man/fmt_integer.Rd index 19137838c..47a4769b5 100644 --- a/man/fmt_integer.Rd +++ b/man/fmt_integer.Rd @@ -27,9 +27,9 @@ focused on selections. The select helper functions are: \code{\link[=starts_with \code{\link[=ends_with]{ends_with()}}, \code{\link[=contains]{contains()}}, \code{\link[=matches]{matches()}}, \code{\link[=one_of]{one_of()}}, \code{\link[=num_range]{num_range()}}, and \code{\link[=everything]{everything()}}.} -\item{rows}{Optional rows to format. Providing either \code{\link[=everything]{everything()}} (the -default) or \code{TRUE} results in all rows in \code{columns} being formatted. Can -either be a vector of row captions provided in \code{\link[=c]{c()}}, a vector of row +\item{rows}{Optional rows to format. Providing \code{\link[=everything]{everything()}} (the +default) results in all rows in \code{columns} being formatted. Alternatively, +we can supply a vector of row captions within \code{\link[=c]{c()}}, a vector of row indices, or a helper function focused on selections. The select helper functions are: \code{\link[=starts_with]{starts_with()}}, \code{\link[=ends_with]{ends_with()}}, \code{\link[=contains]{contains()}}, \code{\link[=matches]{matches()}}, \code{\link[=one_of]{one_of()}}, \code{\link[=num_range]{num_range()}}, and \code{\link[=everything]{everything()}}. We can also use expressions diff --git a/man/fmt_markdown.Rd b/man/fmt_markdown.Rd index c6b00a5dd..22ca41656 100644 --- a/man/fmt_markdown.Rd +++ b/man/fmt_markdown.Rd @@ -15,9 +15,9 @@ focused on selections. The select helper functions are: \code{\link[=starts_with \code{\link[=ends_with]{ends_with()}}, \code{\link[=contains]{contains()}}, \code{\link[=matches]{matches()}}, \code{\link[=one_of]{one_of()}}, \code{\link[=num_range]{num_range()}}, and \code{\link[=everything]{everything()}}.} -\item{rows}{Optional rows to format. Providing either \code{\link[=everything]{everything()}} (the -default) or \code{TRUE} results in all rows in \code{columns} being formatted. Can -either be a vector of row captions provided in \code{\link[=c]{c()}}, a vector of row +\item{rows}{Optional rows to format. Providing \code{\link[=everything]{everything()}} (the +default) results in all rows in \code{columns} being formatted. Alternatively, +we can supply a vector of row captions within \code{\link[=c]{c()}}, a vector of row indices, or a helper function focused on selections. The select helper functions are: \code{\link[=starts_with]{starts_with()}}, \code{\link[=ends_with]{ends_with()}}, \code{\link[=contains]{contains()}}, \code{\link[=matches]{matches()}}, \code{\link[=one_of]{one_of()}}, \code{\link[=num_range]{num_range()}}, and \code{\link[=everything]{everything()}}. We can also use expressions diff --git a/man/fmt_missing.Rd b/man/fmt_missing.Rd index 0f4775a76..5c347ac6b 100644 --- a/man/fmt_missing.Rd +++ b/man/fmt_missing.Rd @@ -15,9 +15,9 @@ focused on selections. The select helper functions are: \code{\link[=starts_with \code{\link[=ends_with]{ends_with()}}, \code{\link[=contains]{contains()}}, \code{\link[=matches]{matches()}}, \code{\link[=one_of]{one_of()}}, \code{\link[=num_range]{num_range()}}, and \code{\link[=everything]{everything()}}.} -\item{rows}{Optional rows to format. Providing either \code{\link[=everything]{everything()}} (the -default) or \code{TRUE} results in all rows in \code{columns} being formatted. Can -either be a vector of row captions provided in \code{\link[=c]{c()}}, a vector of row +\item{rows}{Optional rows to format. Providing \code{\link[=everything]{everything()}} (the +default) results in all rows in \code{columns} being formatted. Alternatively, +we can supply a vector of row captions within \code{\link[=c]{c()}}, a vector of row indices, or a helper function focused on selections. The select helper functions are: \code{\link[=starts_with]{starts_with()}}, \code{\link[=ends_with]{ends_with()}}, \code{\link[=contains]{contains()}}, \code{\link[=matches]{matches()}}, \code{\link[=one_of]{one_of()}}, \code{\link[=num_range]{num_range()}}, and \code{\link[=everything]{everything()}}. We can also use expressions diff --git a/man/fmt_number.Rd b/man/fmt_number.Rd index 5c1ea7af3..f3b30aed5 100644 --- a/man/fmt_number.Rd +++ b/man/fmt_number.Rd @@ -32,9 +32,9 @@ focused on selections. The select helper functions are: \code{\link[=starts_with \code{\link[=ends_with]{ends_with()}}, \code{\link[=contains]{contains()}}, \code{\link[=matches]{matches()}}, \code{\link[=one_of]{one_of()}}, \code{\link[=num_range]{num_range()}}, and \code{\link[=everything]{everything()}}.} -\item{rows}{Optional rows to format. Providing either \code{\link[=everything]{everything()}} (the -default) or \code{TRUE} results in all rows in \code{columns} being formatted. Can -either be a vector of row captions provided in \code{\link[=c]{c()}}, a vector of row +\item{rows}{Optional rows to format. Providing \code{\link[=everything]{everything()}} (the +default) results in all rows in \code{columns} being formatted. Alternatively, +we can supply a vector of row captions within \code{\link[=c]{c()}}, a vector of row indices, or a helper function focused on selections. The select helper functions are: \code{\link[=starts_with]{starts_with()}}, \code{\link[=ends_with]{ends_with()}}, \code{\link[=contains]{contains()}}, \code{\link[=matches]{matches()}}, \code{\link[=one_of]{one_of()}}, \code{\link[=num_range]{num_range()}}, and \code{\link[=everything]{everything()}}. We can also use expressions diff --git a/man/fmt_passthrough.Rd b/man/fmt_passthrough.Rd index 74e3b303c..0160c2c16 100644 --- a/man/fmt_passthrough.Rd +++ b/man/fmt_passthrough.Rd @@ -21,9 +21,9 @@ focused on selections. The select helper functions are: \code{\link[=starts_with \code{\link[=ends_with]{ends_with()}}, \code{\link[=contains]{contains()}}, \code{\link[=matches]{matches()}}, \code{\link[=one_of]{one_of()}}, \code{\link[=num_range]{num_range()}}, and \code{\link[=everything]{everything()}}.} -\item{rows}{Optional rows to format. Providing either \code{\link[=everything]{everything()}} (the -default) or \code{TRUE} results in all rows in \code{columns} being formatted. Can -either be a vector of row captions provided in \code{\link[=c]{c()}}, a vector of row +\item{rows}{Optional rows to format. Providing \code{\link[=everything]{everything()}} (the +default) results in all rows in \code{columns} being formatted. Alternatively, +we can supply a vector of row captions within \code{\link[=c]{c()}}, a vector of row indices, or a helper function focused on selections. The select helper functions are: \code{\link[=starts_with]{starts_with()}}, \code{\link[=ends_with]{ends_with()}}, \code{\link[=contains]{contains()}}, \code{\link[=matches]{matches()}}, \code{\link[=one_of]{one_of()}}, \code{\link[=num_range]{num_range()}}, and \code{\link[=everything]{everything()}}. We can also use expressions diff --git a/man/fmt_percent.Rd b/man/fmt_percent.Rd index 9a0197752..266983656 100644 --- a/man/fmt_percent.Rd +++ b/man/fmt_percent.Rd @@ -32,9 +32,9 @@ focused on selections. The select helper functions are: \code{\link[=starts_with \code{\link[=ends_with]{ends_with()}}, \code{\link[=contains]{contains()}}, \code{\link[=matches]{matches()}}, \code{\link[=one_of]{one_of()}}, \code{\link[=num_range]{num_range()}}, and \code{\link[=everything]{everything()}}.} -\item{rows}{Optional rows to format. Providing either \code{\link[=everything]{everything()}} (the -default) or \code{TRUE} results in all rows in \code{columns} being formatted. Can -either be a vector of row captions provided in \code{\link[=c]{c()}}, a vector of row +\item{rows}{Optional rows to format. Providing \code{\link[=everything]{everything()}} (the +default) results in all rows in \code{columns} being formatted. Alternatively, +we can supply a vector of row captions within \code{\link[=c]{c()}}, a vector of row indices, or a helper function focused on selections. The select helper functions are: \code{\link[=starts_with]{starts_with()}}, \code{\link[=ends_with]{ends_with()}}, \code{\link[=contains]{contains()}}, \code{\link[=matches]{matches()}}, \code{\link[=one_of]{one_of()}}, \code{\link[=num_range]{num_range()}}, and \code{\link[=everything]{everything()}}. We can also use expressions diff --git a/man/fmt_scientific.Rd b/man/fmt_scientific.Rd index e830fa5e5..6c0cf10be 100644 --- a/man/fmt_scientific.Rd +++ b/man/fmt_scientific.Rd @@ -27,9 +27,9 @@ focused on selections. The select helper functions are: \code{\link[=starts_with \code{\link[=ends_with]{ends_with()}}, \code{\link[=contains]{contains()}}, \code{\link[=matches]{matches()}}, \code{\link[=one_of]{one_of()}}, \code{\link[=num_range]{num_range()}}, and \code{\link[=everything]{everything()}}.} -\item{rows}{Optional rows to format. Providing either \code{\link[=everything]{everything()}} (the -default) or \code{TRUE} results in all rows in \code{columns} being formatted. Can -either be a vector of row captions provided in \code{\link[=c]{c()}}, a vector of row +\item{rows}{Optional rows to format. Providing \code{\link[=everything]{everything()}} (the +default) results in all rows in \code{columns} being formatted. Alternatively, +we can supply a vector of row captions within \code{\link[=c]{c()}}, a vector of row indices, or a helper function focused on selections. The select helper functions are: \code{\link[=starts_with]{starts_with()}}, \code{\link[=ends_with]{ends_with()}}, \code{\link[=contains]{contains()}}, \code{\link[=matches]{matches()}}, \code{\link[=one_of]{one_of()}}, \code{\link[=num_range]{num_range()}}, and \code{\link[=everything]{everything()}}. We can also use expressions diff --git a/man/fmt_time.Rd b/man/fmt_time.Rd index 5c3da3ab8..e95dbee7a 100644 --- a/man/fmt_time.Rd +++ b/man/fmt_time.Rd @@ -15,9 +15,9 @@ focused on selections. The select helper functions are: \code{\link[=starts_with \code{\link[=ends_with]{ends_with()}}, \code{\link[=contains]{contains()}}, \code{\link[=matches]{matches()}}, \code{\link[=one_of]{one_of()}}, \code{\link[=num_range]{num_range()}}, and \code{\link[=everything]{everything()}}.} -\item{rows}{Optional rows to format. Providing either \code{\link[=everything]{everything()}} (the -default) or \code{TRUE} results in all rows in \code{columns} being formatted. Can -either be a vector of row captions provided in \code{\link[=c]{c()}}, a vector of row +\item{rows}{Optional rows to format. Providing \code{\link[=everything]{everything()}} (the +default) results in all rows in \code{columns} being formatted. Alternatively, +we can supply a vector of row captions within \code{\link[=c]{c()}}, a vector of row indices, or a helper function focused on selections. The select helper functions are: \code{\link[=starts_with]{starts_with()}}, \code{\link[=ends_with]{ends_with()}}, \code{\link[=contains]{contains()}}, \code{\link[=matches]{matches()}}, \code{\link[=one_of]{one_of()}}, \code{\link[=num_range]{num_range()}}, and \code{\link[=everything]{everything()}}. We can also use expressions From b2cf77b319b82b45d29171af6150f71e0925765a Mon Sep 17 00:00:00 2001 From: Richard Iannone Date: Fri, 28 Jan 2022 12:09:49 -0500 Subject: [PATCH 03/11] Update LICENSE --- LICENSE | 2 +- LICENSE.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/LICENSE b/LICENSE index 4373e9866..cb3768769 100644 --- a/LICENSE +++ b/LICENSE @@ -1,2 +1,2 @@ -YEAR: 2018-2021 +YEAR: 2018-2022 COPYRIGHT HOLDER: RStudio, PBC diff --git a/LICENSE.md b/LICENSE.md index bf573d358..3c068d1e4 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2018-2021 RStudio, PBC +Copyright (c) 2018-2022 RStudio, PBC Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation From 6bb3b5939d5824a4b70c0a8ed7e46c7bc90374c9 Mon Sep 17 00:00:00 2001 From: Richard Iannone Date: Fri, 28 Jan 2022 12:12:30 -0500 Subject: [PATCH 04/11] Update intro-creating-gt-tables.Rmd --- vignettes/intro-creating-gt-tables.Rmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vignettes/intro-creating-gt-tables.Rmd b/vignettes/intro-creating-gt-tables.Rmd index 035d55c48..de4162cb2 100644 --- a/vignettes/intro-creating-gt-tables.Rmd +++ b/vignettes/intro-creating-gt-tables.Rmd @@ -4,7 +4,7 @@ output: rmarkdown::html_vignette: self_contained: true vignette: > - %\VignetteIndexEntry{Intro to Creating gt Tables} + %\VignetteIndexEntry{Introduction to Creating gt Tables} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- From abc7ae6dde28d94e017c42e4053405c96e1ae9d9 Mon Sep 17 00:00:00 2001 From: Richard Iannone Date: Fri, 28 Jan 2022 12:15:58 -0500 Subject: [PATCH 05/11] Delete README.Rmd --- README.Rmd | 143 ----------------------------------------------------- 1 file changed, 143 deletions(-) delete mode 100644 README.Rmd diff --git a/README.Rmd b/README.Rmd deleted file mode 100644 index 88b89a1c4..000000000 --- a/README.Rmd +++ /dev/null @@ -1,143 +0,0 @@ ---- -output: github_document ---- - - - -```{r setup, include = FALSE} -knitr::opts_chunk$set( - collapse = TRUE, - comment = "#>", - fig.path = "man/figures/README-", - out.width = "100%" -) -``` - -# gt - - -[![CRAN -status](https://www.r-pkg.org/badges/version/gt)](https://cran.r-project.org/package=gt) -[![R build status](https://github.com/rstudio/gt/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/rstudio/gt/actions) -[![Coverage -status](https://codecov.io/gh/rstudio/gt/branch/master/graph/badge.svg)](https://codecov.io/github/rstudio/gt?branch=master) - - -With the **gt** package, anyone can make wonderful-looking tables using the **R** programming language. The **gt** philosophy: we can construct a wide variety of useful tables with a cohesive set of table parts. These include the *table header*, the *stub*, the *column labels* and *spanner column labels*, the *table body*, and the *table footer*. - -

- -It all begins with **table data** (be it a tibble or a data frame). You then decide how to compose your **gt table** with the elements and formatting you need for the task at hand. Finally, the table is rendered by printing it at the console, including it in an R Markdown document, or exporting to a file using `gtsave()`. Currently, **gt** supports the **HTML**, **LaTeX**, and **RTF** output formats. - -

- -The **gt** package is designed to be both straightforward yet powerful. The emphasis is on simple functions for the everyday display table needs. Here is a brief example of how to use **gt** to create a table from the included `sp500` dataset: - -```{r sp500_example, eval=FALSE} -library(gt) -library(tidyverse) -library(glue) - -# Define the start and end dates for the data range -start_date <- "2010-06-07" -end_date <- "2010-06-14" - -# Create a gt table based on preprocessed -# `sp500` table data -sp500 %>% - filter(date >= start_date & date <= end_date) %>% - select(-adj_close) %>% - gt() %>% - tab_header( - title = "S&P 500", - subtitle = glue("{start_date} to {end_date}") - ) %>% - fmt_date( - columns = date, - date_style = 3 - ) %>% - fmt_currency( - columns = c(open, high, low, close), - currency = "USD" - ) %>% - fmt_number( - columns = volume, - suffixing = TRUE - ) -``` - -

- -There are six datasets included in **gt**: `countrypops`, `sza`, `gtcars`, `sp500`, `pizzaplace`, and `exibble`. All of them are useful for experimenting with **gt**'s functions. - -Beyond this simple example, there are many functions available in **gt** for creating super-customized tables. - -Want to try this out? Then, take the **gt** Test Drive on **RStudio Cloud**. It's full of ready-to-run examples. - -

- -RStudio Cloud Example - -

- -The **gt** package can be installed from **CRAN** with: - -```{r install_cran, eval=FALSE} -install.packages("gt") -``` - -You can also choose to install the development version of **gt** from **GitHub**: - -```{r install_github, eval=FALSE} -devtools::install_github("rstudio/gt") -``` - -If you encounter a bug, have usage questions, or want to share ideas to make this package better, please feel free to file an [issue](https://github.com/rstudio/gt/issues). - -*** - -#### How **gt** fits in with Other Packages that Generate Display Tables - -The **gt** package joins a burgeoning collection of packages for display table generation. Why another? We feel that there is enough room in this space to innovate further. Here are some of the ways that **gt** contributes to this ecosystem: - -- the interface is high-level and declarative (general instructions versus very specific) -- the formatting options are 'batteries included' (scientific notation, uncertainty, ranges, percentages, suffixes, localized currency, dates/times + much more) -- there is excellent, pain-free support for footnotes -- the output is 'camera-ready' -- multiple output formats are supported with the same declarative interface -- the API closely follows tidyverse conventions by adhering to the [tidyverse style guide](https://style.tidyverse.org) -- there's a focus on making the package documentation and examples the best they can be -- rigorous QA/QC measures: high test coverage for automated tests, and thorough manual testing by QA engineers (with every proposed code change) - -While **gt** is trying to do something different with its own interface, it may not suit your specific needs. Here is a listing of other leading table-making **R** packages, with links to their respective project pages: - -- **knitr** ([GITHUB](https://github.com/yihui/knitr), [WEBSITE](https://yihui.org/knitr/)) -- **kableExtra** ([GITHUB](https://github.com/haozhu233/kableExtra), [WEBSITE](https://haozhu233.github.io/kableExtra/)) -- **formattable** ([GITHUB](https://github.com/renkun-ken/formattable), [WEBSITE](https://renkun-ken.github.io/formattable/)) -- **DT** ([GITHUB](https://github.com/rstudio/DT), [WEBSITE](https://rstudio.github.io/DT/)) -- **pander** ([GITHUB](https://github.com/Rapporter/pander), [WEBSITE](http://rapporter.github.io/pander)) -- **huxtable** ([GITHUB](https://github.com/hughjonesd/huxtable), [WEBSITE](https://hughjonesd.github.io/huxtable/)) -- **reactable** ([GITHUB](https://github.com/glin/reactable), [WEBSITE](https://glin.github.io/reactable/)) -- **flextable** ([GITHUB](https://github.com/davidgohel/flextable), [WEBSITE](https://davidgohel.github.io/flextable/)) -- **ftextra** ([GITHUB](https://github.com/atusy/ftExtra), [WEBSITE](https://ftextra.atusy.net/)) -- **pixiedust** ([GITHUB](https://github.com/nutterb/pixiedust)) -- **tangram** ([GITHUB](https://github.com/spgarbet/tangram)) -- **ztable** ([GITHUB](https://github.com/cardiomoon/ztable)) -- **condformat** ([GITHUB](https://github.com/zeehio/condformat)) -- **stargazer** ([CRAN](https://CRAN.R-project.org/package=stargazer)) -- **xtable** ([CRAN](https://CRAN.R-project.org/package=xtable)) - -#### Code of Conduct - -Please note that the gt project is released with a [contributor code of conduct](https://www.contributor-covenant.org/version/2/0/code_of_conduct/).
By participating in this project you agree to abide by its terms. - -#### 📄 License - -**gt** is licensed under the MIT license. -See the [`LICENSE.md`](LICENSE.md) file for more details. - -© RStudio, PBC. - -*** - -

From 78baa95e4b484d97781f06828c0e608fd010344a Mon Sep 17 00:00:00 2001 From: Richard Iannone Date: Fri, 28 Jan 2022 12:16:05 -0500 Subject: [PATCH 06/11] Update README.md --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 0f2dee954..a082974c9 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,4 @@ - - # gt From b81cdb01f46cec23a2400fe50fda0a2ce622cf6b Mon Sep 17 00:00:00 2001 From: Richard Iannone Date: Fri, 28 Jan 2022 13:20:35 -0500 Subject: [PATCH 07/11] Add dedicated ISSUE TEMPLATEs --- .github/ISSUE_TEMPLATE.md | 15 ------------- .github/ISSUE_TEMPLATE/bug.md | 35 ++++++++++++++++++++++++++++++ .github/ISSUE_TEMPLATE/feature.md | 18 +++++++++++++++ .github/ISSUE_TEMPLATE/question.md | 27 +++++++++++++++++++++++ 4 files changed, 80 insertions(+), 15 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/ISSUE_TEMPLATE/bug.md create mode 100644 .github/ISSUE_TEMPLATE/feature.md create mode 100644 .github/ISSUE_TEMPLATE/question.md diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index 912ef5a3d..000000000 --- a/.github/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,15 +0,0 @@ -Please briefly describe your problem or your ideas for enhancement in the template below. - -Have a question? Please don't use this form but instead ask on [RStudio community](https://community.rstudio.com), on [Stack Overflow](https://stackoverflow.com), or on Twitter (using the `#rstats` hashtag). - -When describing a bug, please include a minimal reproducible example (otherwise known as a [reprex](http://reprex.tidyverse.org/)). - -When posting, delete these explanatory lines and submit only the text derived from the template below. - ---- - - - -```r - -``` diff --git a/.github/ISSUE_TEMPLATE/bug.md b/.github/ISSUE_TEMPLATE/bug.md new file mode 100644 index 000000000..49aabb017 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug.md @@ -0,0 +1,35 @@ +--- +name: Bug +about: Something is wrong with gt. +title: '' +labels: 'Type: ☹︎ Bug' +assignees: rich-iannone +--- + +## Prework + +* [ ] Read and agree to the [code of conduct](https://www.contributor-covenant.org/version/2/0/code_of_conduct/) and [contributing guidelines](https://github.com/rstudio/gt/blob/master/.github/CONTRIBUTING.md). +* [ ] If there is [already a relevant issue](https://github.com/rstudio/gt/issues), whether open or closed, comment on the existing thread instead of posting a new issue. +* [ ] Post a [minimal reproducible example](https://www.tidyverse.org/help/) so the maintainer can troubleshoot the problems you identify. A reproducible example is: + * [ ] **Runnable**: post enough R code and data so any onlooker can create the error on their own computer. + * [ ] **Minimal**: reduce runtime wherever possible and remove complicated details that are irrelevant to the issue at hand. + * [ ] **Readable**: format your code according to the [tidyverse style guide](https://style.tidyverse.org/). + +## Description + +Describe the bug clearly and concisely. + +## Reproducible example + +* [ ] Post a [minimal reproducible example](https://www.tidyverse.org/help/) so the maintainer can troubleshoot the problems you identify. A reproducible example is: + * [ ] **Runnable**: post enough R code and data so any onlooker can create the error on their own computer. + * [ ] **Minimal**: reduce runtime wherever possible and remove complicated details that are irrelevant to the issue at hand. + * [ ] **Readable**: format your code according to the [tidyverse style guide](https://style.tidyverse.org/). + +## Expected result + +What should have happened? Please be as specific as possible. + +## Session info + +End the reproducible example with a call to `sessionInfo()` in the same session (e.g. `reprex(session_info = TRUE)`) and include the output. diff --git a/.github/ISSUE_TEMPLATE/feature.md b/.github/ISSUE_TEMPLATE/feature.md new file mode 100644 index 000000000..914782d5e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature.md @@ -0,0 +1,18 @@ +--- +name: New feature +about: Suggest a new feature. +title: '' +labels: 'Type: ★ Enhancement' +assignees: rich-iannone +--- + +## Prework + +- [ ] Read and abide by **gt**'s [code of conduct](https://www.contributor-covenant.org/version/2/0/code_of_conduct/) and [contributing guidelines](https://github.com/rstudio/gt/blob/master/.github/CONTRIBUTING.md). +- [ ] Search for duplicates among the [existing issues](https://github.com/rstudio/gt/issues) (both open and closed). + +## Proposal + +Describe the new feature clearly and concisely. If applicable, write a minimal example in R code or pseudo-code to show input, usage, and desired output. + +To help us read any code you include (optional) please try to follow the [tidyverse style guide](https://style.tidyverse.org/). The `style_text()` and `style_file()` functions from the [`styler`](https://github.com/r-lib/styler) package make it easier. diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md new file mode 100644 index 000000000..4a9a0cd04 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/question.md @@ -0,0 +1,27 @@ +--- +name: Question +about: Ask a question. +title: '' +labels: 'Type: ⁇ Question' +assignees: '' +--- + +## Prework + +* [ ] Read and agree to the [code of conduct](https://www.contributor-covenant.org/version/2/0/code_of_conduct/) and [contributing guidelines](https://github.com/rstudio/gt/blob/master/.github/CONTRIBUTING.md). +* [ ] If there is [already a relevant issue](https://github.com/rstudio/gt/issues), whether open or closed, comment on the existing thread instead of posting a new issue. +* [ ] For any problems you identify, a [minimal reproducible example](https://www.tidyverse.org/help/) so the maintainer can troubleshoot. A reproducible example is: + * [ ] **Runnable**: post enough R code and data so any onlooker can create the error on their own computer. + * [ ] **Minimal**: reduce runtime wherever possible and remove complicated details that are irrelevant to the issue at hand. + * [ ] **Readable**: format your code according to the [tidyverse style guide](https://style.tidyverse.org/). + +## Question + +What would you like to know? + +## Reproducible example + +* [ ] For any problems you identify, post a [minimal reproducible example](https://www.tidyverse.org/help/) so the maintainer can troubleshoot. A reproducible example is: + * [ ] **Runnable**: post enough R code and data so any onlooker can create the error on their own computer. + * [ ] **Minimal**: reduce runtime wherever possible and remove complicated details that are irrelevant to the issue at hand. + * [ ] **Readable**: format your code according to the [tidyverse style guide](https://style.tidyverse.org/). From ea07de80420e6c10fdc092caaaac4f14fdcdc839 Mon Sep 17 00:00:00 2001 From: Richard Iannone Date: Fri, 28 Jan 2022 15:30:52 -0500 Subject: [PATCH 08/11] Update README.md --- README.md | 77 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 43 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index a082974c9..8dc474979 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,24 @@ +
-# gt + +
+CRAN status +R build status +Coverage status -[![CRAN -status](https://www.r-pkg.org/badges/version/gt)](https://cran.r-project.org/package=gt) -[![R build -status](https://github.com/rstudio/gt/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/rstudio/gt/actions) -[![Coverage -status](https://codecov.io/gh/rstudio/gt/branch/master/graph/badge.svg)](https://codecov.io/github/rstudio/gt?branch=master) +The project has reached a stable, usable state and is being actively developed. +Monthly Downloads +Total Downloads + +[![RStudio community](https://img.shields.io/badge/RStudio%20Cloud-gt%20Test%20Drive-blue?style=social&logo=rstudio&logoColor=75AADB)](https://rstudio.cloud/project/779965) + +Contributor Covenant +
+
+
With the **gt** package, anyone can make wonderful-looking tables using the **R** programming language. The **gt** philosophy: we can construct @@ -17,11 +26,9 @@ a wide variety of useful tables with a cohesive set of table parts. These include the *table header*, the *stub*, the *column labels* and *spanner column labels*, the *table body*, and the *table footer*. -

- +

- -

+
It all begins with **table data** (be it a tibble or a data frame). You then decide how to compose your **gt table** with the elements and @@ -30,11 +37,11 @@ by printing it at the console, including it in an R Markdown document, or exporting to a file using `gtsave()`. Currently, **gt** supports the **HTML**, **LaTeX**, and **RTF** output formats. -

- +

+
-

+
The **gt** package is designed to be both straightforward yet powerful. The emphasis is on simple functions for the everyday display table @@ -74,29 +81,27 @@ sp500 %>% ) ``` -

- - - -

+
+ +
There are six datasets included in **gt**: `countrypops`, `sza`, `gtcars`, `sp500`, `pizzaplace`, and `exibble`. All of them are useful for experimenting with **gt**’s functions. Beyond this simple example, there are many functions available in **gt** -for creating super-customized tables. - -Want to try this out? Then, take the **gt** Test Drive on **RStudio -Cloud**. It’s full of ready-to-run examples. +for creating super-customized tables. For much more information on these, visit the +[documentation website](https://gt.rstudio.com/) or take +a *Test Drive* in the [RStudio Cloud project](https://rstudio.cloud/project/779965). -

+## DISCUSSIONS - -RStudio Cloud Example - +Let's talk about making tables with **gt** in +[*Discussions*](https://github.com/rstudio/gt/discussions)! +It's a great place to ask questions about how to use the package, discuss +some ideas, engage with others, and much more! -

+## INSTALLATION The **gt** package can be installed from **CRAN** with: @@ -117,7 +122,7 @@ make this package better, please feel free to file an ----- -#### How **gt** fits in with Other Packages that Generate Display Tables +## How **gt** fits in with Other Packages that Generate Display Tables The **gt** package joins a burgeoning collection of packages for display table generation. Why another? We feel that there is enough room in this @@ -162,23 +167,27 @@ pages: - **stargazer** ([CRAN](https://CRAN.R-project.org/package=stargazer)) - **xtable** ([CRAN](https://CRAN.R-project.org/package=xtable)) -#### Code of Conduct +## Code of Conduct Please note that the gt project is released with a [contributor code of conduct](https://www.contributor-covenant.org/version/2/0/code_of_conduct/).
By participating in this project you agree to abide by its terms. -#### 📄 License +## 📄 License **gt** is licensed under the MIT license. See the [`LICENSE.md`](LICENSE.md) file for more details. © RStudio, PBC. ------ +## 🏛️ Governance + +This project is primarily maintained by [Rich Iannone](https://twitter.com/riannone). Other authors may occasionally assist with some of these duties. -

+


+
+
-

+
From d5d6585f84d2f229f90a047cf22eca272bf07765 Mon Sep 17 00:00:00 2001 From: Richard Iannone Date: Fri, 28 Jan 2022 15:31:00 -0500 Subject: [PATCH 09/11] Update gt_parts_of_a_table.svg --- man/figures/gt_parts_of_a_table.svg | 147 +++++++++++++--------------- 1 file changed, 70 insertions(+), 77 deletions(-) diff --git a/man/figures/gt_parts_of_a_table.svg b/man/figures/gt_parts_of_a_table.svg index 147e4a427..acf6bab11 100644 --- a/man/figures/gt_parts_of_a_table.svg +++ b/man/figures/gt_parts_of_a_table.svg @@ -1,24 +1,22 @@ - - - gt_parts_of_a_table_svg - Created with Sketch. + + gt_parts_of_a_table - + - + - + @@ -27,120 +25,115 @@ - + - + - + - + - + - + - + - - - SVG Version - - - - - - + + + + - + - - - - - + + - - - - - - - - - - - - - - - + + - + - + - + - - - - - - - - - - - + + + + - - + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 3a9a9b3f1dc1e8339a6fc6ec6592c1212b8ed244 Mon Sep 17 00:00:00 2001 From: Richard Iannone Date: Fri, 28 Jan 2022 15:33:20 -0500 Subject: [PATCH 10/11] Update gt_workflow_diagram.svg --- man/figures/gt_workflow_diagram.svg | 262 ++++++++++++++-------------- 1 file changed, 131 insertions(+), 131 deletions(-) diff --git a/man/figures/gt_workflow_diagram.svg b/man/figures/gt_workflow_diagram.svg index c4d87cddf..563f58bf1 100644 --- a/man/figures/gt_workflow_diagram.svg +++ b/man/figures/gt_workflow_diagram.svg @@ -1,145 +1,145 @@ - + gt_workflow_diagram - + - - - output as HTML - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + \ No newline at end of file From 86014db3177f0a97f8c0e19ad437051328482764 Mon Sep 17 00:00:00 2001 From: Richard Iannone Date: Tue, 1 Feb 2022 16:39:21 -0500 Subject: [PATCH 11/11] Change HTML percent sign to literal `%` (#871) * Change HTML percent sign to literal `%` * Update several testthat tests Co-authored-by: Joe Cheng --- R/utils_formatters.R | 2 +- tests/testthat/test-cols_merge.R | 12 ++- tests/testthat/test-conditional_fmt.R | 6 +- tests/testthat/test-fmt_number.R | 18 ++-- tests/testthat/test-fmt_percent.R | 118 +++++++++++++------------- 5 files changed, 77 insertions(+), 79 deletions(-) diff --git a/R/utils_formatters.R b/R/utils_formatters.R index 71685f267..cc0da0973 100644 --- a/R/utils_formatters.R +++ b/R/utils_formatters.R @@ -450,7 +450,7 @@ context_minus_mark <- function(context) { context_percent_mark <- function(context) { switch(context, - html = "%", + html = "%", latex = "\\%", "%") } diff --git a/tests/testthat/test-cols_merge.R b/tests/testthat/test-cols_merge.R index 2da95472f..db2bd2de3 100644 --- a/tests/testthat/test-cols_merge.R +++ b/tests/testthat/test-cols_merge.R @@ -1,5 +1,3 @@ -context("Ensuring that the `cols_merge*()` functions work as expected") - # Create a shortened version of `mtcars` mtcars_short <- mtcars[1:5, ] @@ -480,17 +478,17 @@ test_that("the `cols_merge_n_pct()` function works correctly", { expect_equal( (tbl_html %>% render_formats_test("html"))[["a"]], c( - "1 (7.1%)", "5 (35.7%)", "0", "2 (14.3%)", - "NA", "6 (42.9%)", "5", "NA", "0", "NA" + "1 (7.1%)", "5 (35.7%)", "0", "2 (14.3%)", + "NA", "6 (42.9%)", "5", "NA", "0", "NA" ) ) expect_equal( (tbl_html %>% render_formats_test("html"))[["b"]], c( - "7.1%", "35.7%", "0.0%", "14.3%", - "NA", "42.9%", "NA", "100,000.0%", "NA", - "0.0%" + "7.1%", "35.7%", "0.0%", "14.3%", + "NA", "42.9%", "NA", "100,000.0%", "NA", + "0.0%" ) ) }) diff --git a/tests/testthat/test-conditional_fmt.R b/tests/testthat/test-conditional_fmt.R index 5d37a7122..49202123f 100644 --- a/tests/testthat/test-conditional_fmt.R +++ b/tests/testthat/test-conditional_fmt.R @@ -88,8 +88,8 @@ test_that("the `fmt_percent()` function works with conditional `rows`", { decimals = 2, rows = num_1 < 1000) %>% render_formats_test(context = "html"))[["num_1"]], - c("1836.23", "2763.39", "93,729.00%", "64,300.00%", - "21,223.20%", "0.00%", "−2,324.00%") + c("1836.23", "2763.39", "93,729.00%", "64,300.00%", + "21,223.20%", "0.00%", "−2,324.00%") ) expect_equal( @@ -99,7 +99,7 @@ test_that("the `fmt_percent()` function works with conditional `rows`", { decimals = 2, rows = char_2 %in% c("june", "july") & grepl("sa.*", char_1)) %>% render_formats_test(context = "html"))[["num_2"]], - c("3,400.00%", "74", "23", "NA", "35", "NA", "NA") + c("3,400.00%", "74", "23", "NA", "35", "NA", "NA") ) }) diff --git a/tests/testthat/test-fmt_number.R b/tests/testthat/test-fmt_number.R index 8df074abe..245f47eec 100644 --- a/tests/testthat/test-fmt_number.R +++ b/tests/testthat/test-fmt_number.R @@ -667,9 +667,9 @@ test_that("the `drop_trailing_dec_mark` option works in select `fmt_*()` functio fmt_percent(columns = num, drop_trailing_dec_mark = TRUE) %>% render_formats_test(context = "html"))[["num"]], c( - "0.10%", "1.00%", "10.00%", "0.00%", - "100.00%", "110.00%", "112.00%", "5,000,000.00%", - "−150.00%", "−500.00%", "−50,010.00%" + "0.10%", "1.00%", "10.00%", "0.00%", + "100.00%", "110.00%", "112.00%", "5,000,000.00%", + "−150.00%", "−500.00%", "−50,010.00%" ) ) @@ -679,9 +679,9 @@ test_that("the `drop_trailing_dec_mark` option works in select `fmt_*()` functio fmt_percent(columns = num, decimals = 0) %>% render_formats_test(context = "html"))[["num"]], c( - "0%", "1%", "10%", "0%", "100%", - "110%", "112%", "5,000,000%", "−150%", - "−500%", "−50,010%" + "0%", "1%", "10%", "0%", "100%", + "110%", "112%", "5,000,000%", "−150%", + "−500%", "−50,010%" ) ) @@ -692,9 +692,9 @@ test_that("the `drop_trailing_dec_mark` option works in select `fmt_*()` functio fmt_percent(columns = num, decimals = 0, drop_trailing_dec_mark = FALSE) %>% render_formats_test(context = "html"))[["num"]], c( - "0.%", "1.%", "10.%", "0.%", "100.%", - "110.%", "112.%", "5,000,000.%", "−150.%", - "−500.%", "−50,010.%" + "0.%", "1.%", "10.%", "0.%", "100.%", + "110.%", "112.%", "5,000,000.%", "−150.%", + "−500.%", "−50,010.%" ) ) diff --git a/tests/testthat/test-fmt_percent.R b/tests/testthat/test-fmt_percent.R index 082ec5af0..048c6d99e 100644 --- a/tests/testthat/test-fmt_percent.R +++ b/tests/testthat/test-fmt_percent.R @@ -35,9 +35,9 @@ test_that("the `fmt_percent()` function works correctly in the HTML context", { fmt_percent(columns = num_1, decimals = 2) %>% render_formats_test("html"))[["num_1"]], c( - "183,623.00%", "276,339.00%", "93,729.00%", - "64,300.00%", "21,223.20%", "0.00%", - "−2,324.00%" + "183,623.00%", "276,339.00%", "93,729.00%", + "64,300.00%", "21,223.20%", "0.00%", + "−2,324.00%" ) ) @@ -47,9 +47,9 @@ test_that("the `fmt_percent()` function works correctly in the HTML context", { fmt_percent(columns = num_1, decimals = 5) %>% render_formats_test("html"))[["num_1"]], c( - "183,623.00000%", "276,339.00000%", "93,729.00000%", - "64,300.00000%", "21,223.20000%", "0.00000%", - "−2,324.00000%" + "183,623.00000%", "276,339.00000%", "93,729.00000%", + "64,300.00000%", "21,223.20000%", "0.00000%", + "−2,324.00000%" ) ) @@ -61,8 +61,8 @@ test_that("the `fmt_percent()` function works correctly in the HTML context", { drop_trailing_zeros = TRUE) %>% render_formats_test("html"))[["num_1"]], c( - "183,623%", "276,339%", "93,729%", "64,300%", - "21,223.2%", "0%", "−2,324%" + "183,623%", "276,339%", "93,729%", "64,300%", + "21,223.2%", "0%", "−2,324%" ) ) @@ -73,9 +73,9 @@ test_that("the `fmt_percent()` function works correctly in the HTML context", { fmt_percent(columns = num_1, decimals = 2, use_seps = FALSE) %>% render_formats_test("html"))[["num_1"]], c( - "183623.00%", "276339.00%", "93729.00%", - "64300.00%", "21223.20%", "0.00%", - "−2324.00%" + "183623.00%", "276339.00%", "93729.00%", + "64300.00%", "21223.20%", "0.00%", + "−2324.00%" ) ) @@ -86,9 +86,9 @@ test_that("the `fmt_percent()` function works correctly in the HTML context", { fmt_percent(columns = num_1, decimals = 2, sep_mark = " ") %>% render_formats_test("html"))[["num_1"]], c( - "183 623.00%", "276 339.00%", "93 729.00%", - "64 300.00%", "21 223.20%", "0.00%", - "−2 324.00%" + "183 623.00%", "276 339.00%", "93 729.00%", + "64 300.00%", "21 223.20%", "0.00%", + "−2 324.00%" ) ) @@ -101,9 +101,9 @@ test_that("the `fmt_percent()` function works correctly in the HTML context", { sep_mark = ".", dec_mark = ",") %>% render_formats_test("html"))[["num_1"]], c( - "183.623,00%", "276.339,00%", "93.729,00%", - "64.300,00%", "21.223,20%", "0,00%", - "−2.324,00%" + "183.623,00%", "276.339,00%", "93.729,00%", + "64.300,00%", "21.223,20%", "0,00%", + "−2.324,00%" ) ) @@ -114,10 +114,10 @@ test_that("the `fmt_percent()` function works correctly in the HTML context", { fmt_percent(columns = num_1, decimals = 2, pattern = "a {x}:n") %>% render_formats_test("html"))[["num_1"]], c( - "a 183,623.00%:n", "a 276,339.00%:n", - "a 93,729.00%:n", "a 64,300.00%:n", - "a 21,223.20%:n", "a 0.00%:n", - "a −2,324.00%:n" + "a 183,623.00%:n", "a 276,339.00%:n", + "a 93,729.00%:n", "a 64,300.00%:n", + "a 21,223.20%:n", "a 0.00%:n", + "a −2,324.00%:n" ) ) @@ -129,9 +129,9 @@ test_that("the `fmt_percent()` function works correctly in the HTML context", { placement = "right", incl_space = TRUE) %>% render_formats_test("html"))[["num_1"]], c( - "183,623 %", "276,339 %", "93,729 %", - "64,300 %", "21,223 %", "0 %", - "−2,324 %" + "183,623 %", "276,339 %", "93,729 %", + "64,300 %", "21,223 %", "0 %", + "−2,324 %" ) ) @@ -143,9 +143,9 @@ test_that("the `fmt_percent()` function works correctly in the HTML context", { placement = "left", incl_space = TRUE) %>% render_formats_test("html"))[["num_1"]], c( - "% 183,623", "% 276,339", "% 93,729", - "% 64,300", "% 21,223", "% 0", - "−% 2,324" + "% 183,623", "% 276,339", "% 93,729", + "% 64,300", "% 21,223", "% 0", + "−% 2,324" ) ) @@ -155,8 +155,8 @@ test_that("the `fmt_percent()` function works correctly in the HTML context", { fmt_percent(columns = num_1, accounting = TRUE) %>% render_formats_test("html"))[["num_1"]], c( - "183,623.00%", "276,339.00%", "93,729.00%", - "64,300.00%", "21,223.20%", "0.00%", "(2,324.00%)" + "183,623.00%", "276,339.00%", "93,729.00%", + "64,300.00%", "21,223.20%", "0.00%", "(2,324.00%)" ) ) @@ -166,9 +166,9 @@ test_that("the `fmt_percent()` function works correctly in the HTML context", { fmt_percent(columns = num_1, decimals = 3, accounting = TRUE) %>% render_formats_test("html"))[["num_1"]], c( - "183,623.000%", "276,339.000%", "93,729.000%", - "64,300.000%", "21,223.200%", "0.000%", - "(2,324.000%)" + "183,623.000%", "276,339.000%", "93,729.000%", + "64,300.000%", "21,223.200%", "0.000%", + "(2,324.000%)" ) ) @@ -181,9 +181,9 @@ test_that("the `fmt_percent()` function works correctly in the HTML context", { accounting = TRUE, pattern = "a{x}b") %>% render_formats_test("html"))[["num_1"]], c( - "a183,623.000%b", "a276,339.000%b", "a93,729.000%b", - "a64,300.000%b", "a21,223.200%b", "a0.000%b", - "a(2,324.000%)b" + "a183,623.000%b", "a276,339.000%b", "a93,729.000%b", + "a64,300.000%b", "a21,223.200%b", "a0.000%b", + "a(2,324.000%)b" ) ) @@ -196,8 +196,8 @@ test_that("the `fmt_percent()` function works correctly in the HTML context", { accounting = TRUE, drop_trailing_zeros = TRUE) %>% render_formats_test("html"))[["num_1"]], c( - "183,623%", "276,339%", "93,729%", "64,300%", - "21,223.2%", "0%", "(2,324%)" + "183,623%", "276,339%", "93,729%", "64,300%", + "21,223.2%", "0%", "(2,324%)" ) ) @@ -210,8 +210,8 @@ test_that("the `fmt_percent()` function works correctly in the HTML context", { ) %>% render_formats_test("html"))[["num_1"]], c( - "+1,836.23%", "+2,763.39%", "+937.29%", - "+643%", "+212.23%", "0%", "−23.24%" + "+1,836.23%", "+2,763.39%", "+937.29%", + "+643%", "+212.23%", "0%", "−23.24%" ) ) @@ -242,9 +242,9 @@ test_that("the `fmt_percent()` function works correctly in the HTML context", { ) %>% render_formats_test("html"))[["num_1"]], c( - "*+183,623%*", "*+276,339%*", "*+93,729%*", - "*+64,300%*", "*+21,223.2%*", "*0%*", - "*−2,324%*" + "*+183,623%*", "*+276,339%*", "*+93,729%*", + "*+64,300%*", "*+21,223.2%*", "*0%*", + "*−2,324%*" ) ) @@ -255,9 +255,9 @@ test_that("the `fmt_percent()` function works correctly in the HTML context", { fmt_percent(columns = num_1, decimals = 2, locale = "en_US") %>% render_formats_test("html"))[["num_1"]], c( - "183,623.00%", "276,339.00%", "93,729.00%", - "64,300.00%", "21,223.20%", "0.00%", - "−2,324.00%" + "183,623.00%", "276,339.00%", "93,729.00%", + "64,300.00%", "21,223.20%", "0.00%", + "−2,324.00%" ) ) @@ -268,9 +268,9 @@ test_that("the `fmt_percent()` function works correctly in the HTML context", { fmt_percent(columns = num_1, decimals = 2, locale = "da_DK") %>% render_formats_test("html"))[["num_1"]], c( - "183.623,00%", "276.339,00%", "93.729,00%", - "64.300,00%", "21.223,20%", "0,00%", - "−2.324,00%" + "183.623,00%", "276.339,00%", "93.729,00%", + "64.300,00%", "21.223,20%", "0,00%", + "−2.324,00%" ) ) @@ -281,9 +281,9 @@ test_that("the `fmt_percent()` function works correctly in the HTML context", { fmt_percent(columns = num_1, decimals = 2, locale = "de_AT") %>% render_formats_test("html"))[["num_1"]], c( - "183 623,00%", "276 339,00%", "93 729,00%", - "64 300,00%", "21 223,20%", "0,00%", - "−2 324,00%" + "183 623,00%", "276 339,00%", "93 729,00%", + "64 300,00%", "21 223,20%", "0,00%", + "−2 324,00%" ) ) @@ -294,9 +294,9 @@ test_that("the `fmt_percent()` function works correctly in the HTML context", { fmt_percent(columns = num_1, decimals = 2, locale = "et_EE") %>% render_formats_test("html"))[["num_1"]], c( - "183 623,00%", "276 339,00%", "93 729,00%", - "64 300,00%", "21 223,20%", "0,00%", - "−2 324,00%" + "183 623,00%", "276 339,00%", "93 729,00%", + "64 300,00%", "21 223,20%", "0,00%", + "−2 324,00%" ) ) @@ -307,9 +307,9 @@ test_that("the `fmt_percent()` function works correctly in the HTML context", { fmt_percent(columns = num_1, decimals = 2, locale = "gl_ES") %>% render_formats_test("html"))[["num_1"]], c( - "183.623,00%", "276.339,00%", "93.729,00%", - "64.300,00%", "21.223,20%", "0,00%", - "−2.324,00%" + "183.623,00%", "276.339,00%", "93.729,00%", + "64.300,00%", "21.223,20%", "0,00%", + "−2.324,00%" ) ) @@ -320,8 +320,8 @@ test_that("the `fmt_percent()` function works correctly in the HTML context", { fmt_percent(columns = num_2, decimals = 2, scale_values = FALSE) %>% render_formats_test("html"))[["num_2"]], c( - "34.00%", "74.00%", "23.00%", "93.00%", - "35.00%", "76.00%", "57.00%" + "34.00%", "74.00%", "23.00%", "93.00%", + "35.00%", "76.00%", "57.00%" ) ) })