Skip to content

Commit

Permalink
Merge pull request #1700 from olivroy/edits-pkgdown
Browse files Browse the repository at this point in the history
Edits pkgdown + fixup of some docs
  • Loading branch information
rich-iannone authored Jun 8, 2024
2 parents 8e0b12e + 157eb7e commit e97c62e
Show file tree
Hide file tree
Showing 17 changed files with 64 additions and 74 deletions.
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@

* The `docx` output format is now better detected in R Markdown and Quarto (#1040). (#1084, thanks @cderv!)

* Replaced all `match.arg()` calls with **rlang**'s `match_arg()` for better error output (#672). (#1099, thanks @mojister!)
* Replaced all `match.arg()` calls with `rlang::arg_match()` for better error output (#672). (#1099, thanks @mojister!)

* Project website improvements; we now have a doublet of sites: (1) https://gt.rstudio.com and (2) https://gt.rstudio.com/dev (#1074, thanks @ddsjoberg!)

Expand Down
13 changes: 7 additions & 6 deletions R/format_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -8050,7 +8050,9 @@ extract_duration_pattern <- function(
}

#' Format column data containing bin/interval information

#'
#' @description
#'
#' When using `cut()` (or other functions that use it in some way)
#' you get bins that can look like this: `"(0,10]"`, `"(10,15]"`, `"(15,20]"`,
#' `"(20,40]"`. This interval notation expresses the lower and upper limits of
Expand Down Expand Up @@ -12838,11 +12840,10 @@ fmt_country <- function(
#' Depending on which train services are offered at the subset of stations,
#' *Font Awesome* icon names will be applied to cells where the different
#' services exist (the specific names are `"train-subway"`, `"train"`, and
#' `"train-tram"`). With **tidyr**'s `unite()` function, those icon names
#' can be converged into a single column (`services`) with the `NA` values
#' removed. Since the names correspond to icons and they are in the correct
#' format (separated by commas), they can be formatted as *Font Awesome* icons
#' with `fmt_icon()`.
#' `"train-tram"`). With `tidyr::unite()`, those icon names can be converged
#' into a single column (`services`) with the `NA` values removed. Since the
#' names correspond to icons and they are in the correct format (separated by
#' commas), they can be formatted as *Font Awesome* icons with `fmt_icon()`.
#'
#' ```r
#' metro |>
Expand Down
3 changes: 2 additions & 1 deletion R/info_tables.R
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,8 @@ info_flags <- function() {
#' from the **fontawesome** package). Because there is a very large number of
#' icons available to use in *Font Awesome*, `info_icons()` can be used to
#' provide us with a table that lists all the icons along with their short and
#' full names (either can be used with [fmt_icon()]).
#' full names (either can be used with [fmt_icon()]). It also contains
#' acceptable codes for [fmt_country()]
#'
#' @return An object of class `gt_tbl`.
#'
Expand Down
27 changes: 13 additions & 14 deletions R/modify_columns.R
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ cols_width <- function(
#' The [`illness`] dataset has units within the `units` column. They're
#' formatted in just the right way for **gt** too. Let's do some text
#' manipulation through `dplyr::mutate()` and some pivoting with
#' **tidyr**'s `pivot_longer()` and `pivot_wider()` in order to include the
#' `tidyr::pivot_longer()` and `tidyr::pivot_wider()` in order to include the
#' units as part of the column names in the reworked table. These column names
#' are in a format where the units are included within `"{{"`/`"}}"`, so, we can
#' use `cols_label()` with the `.process_units = TRUE` option to register the
Expand Down Expand Up @@ -1611,18 +1611,17 @@ cols_units <- function(
#'
#' @description
#'
#' We can add new columns to a table with the `cols_add()` function and it works
#' quite a bit like the **dplyr** `mutate()` function. The idea is that you
#' supply name-value pairs where the name is the new column name and the value
#' part describes the data that will go into the column. The latter can:
#' (1) be a vector where the length of the number of rows in the data table,
#' (2) be a single value (which will be repeated all the way down), or (3)
#' involve other columns in the table (as they represent vectors of the correct
#' length). The new columns are added to the end of the column series by default
#' but can instead be added internally by using either the `.before` or `.after`
#' arguments. If entirely empty (i.e., all `NA`) columns need to be added, you
#' can use any of the `NA` types (e.g., `NA`, `NA_character_`, `NA_real_`, etc.)
#' for such columns.
#' We can add new columns to a table with `cols_add()` and it works quite a bit
#' like `dplyr::mutate()` does. The idea is that you supply name-value pairs
#' where the name is the new column name and the value part describes the data
#' that will go into the column. The latter can: (1) be a vector where the
#' length of the number of rows in the data table, (2) be a single value
#' (which will be repeated all the way down), or (3) involve other columns in
#' the table (as they represent vectors of the correct length). The new columns
#' are added to the end of the column series by default but can instead be added
#' internally by using either the `.before` or `.after` arguments. If entirely
#' empty (i.e., all `NA`) columns need to be added, you can use any of the `NA`
#' types (e.g., `NA`, `NA_character_`, `NA_real_`, etc.) for such columns.
#'
#' @inheritParams fmt_number
#'
Expand Down Expand Up @@ -2604,7 +2603,7 @@ cols_add <- function(
#' pizza analytics). We also have the sell price for a pizza, and that'll serve
#' as the *y* values. The pizzas belong to four different groups (in the `type`
#' column) and we'll group by that and create value streams with
#' `paste(..., collapse = ",")` in the **dplyr** summarize call. With two value
#' `paste(..., collapse = ",")` inside the `dplyr::summarize()` call. With two value
#' streams in each row (having the same number of values) we can now make a
#' **gt** table with nanoplots.
#'
Expand Down
2 changes: 1 addition & 1 deletion R/rows_add.R
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
#' Another application is starting from nothing (really just the definition of
#' columns) and building up a table using several invocations of `rows_add()`.
#' This might be useful in interactive or programmatic applications. Here's an
#' example where two columns are defined with **dplyr**'s `tibble()` function
#' example where two columns are defined with `dplyr::tibble()`
#' (and no rows are present initially); with two calls of `rows_add()`, two
#' separate rows are added.
#'
Expand Down
7 changes: 3 additions & 4 deletions R/tab_create_modify.R
Original file line number Diff line number Diff line change
Expand Up @@ -1064,10 +1064,9 @@ resolve_spanned_column_names <- function(
#' }}
#'
#' With a summarized, filtered, and pivoted version of the [`pizzaplace`]
#' dataset, we can create another **gt** table and then use the
#' `tab_spanner_delim()` function with the same delimiter/separator that was
#' used in the **tidyr** `pivot_wider()` call. We can also process the generated
#' column labels with [cols_label_with()].
#' dataset, we can create another **gt** table and then use `tab_spanner_delim()`
#' with the delimiter/separator also used in `tidyr::pivot_wider()`. We can also
#' process the generated column labels with [cols_label_with()].
#'
#' ```r
#' pizzaplace |>
Expand Down
1 change: 1 addition & 0 deletions R/topics.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,5 @@
#' * [text_case_match()]
#'
#' These functions contain more example of usage.
#' @keywords internal
NULL
23 changes: 11 additions & 12 deletions man/cols_add.Rd

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

2 changes: 1 addition & 1 deletion man/cols_label.Rd

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

2 changes: 1 addition & 1 deletion man/cols_nanoplot.Rd

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

12 changes: 1 addition & 11 deletions man/fmt_bins.Rd

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

9 changes: 4 additions & 5 deletions man/fmt_icon.Rd

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

3 changes: 2 additions & 1 deletion man/info_icons.Rd

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

1 change: 1 addition & 0 deletions man/location-helper.Rd

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

2 changes: 1 addition & 1 deletion man/rows_add.Rd

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

7 changes: 3 additions & 4 deletions man/tab_spanner_delim.Rd

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

22 changes: 11 additions & 11 deletions pkgdown/_pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ reference:
All **gt** tables begin with a call to `gt()`, where we would supply the
input data table (data frame or tibble) and some basic options for
creating a stub (`rowname_col`) and row groups (`groupname_col`). We
can also introduce a grouped tibble (via **dplyr**'s `group_by()`) for
more precise divisions of rows into row groups. The `gt_preview()`
function is great for getting a nicely-formatted preview of a data
table (defaulting to the first 5 rows and the last row).
can also introduce a grouped tibble (via `dplyr::group_by()`) for
more precise divisions of rows into row groups. `gt_preview()`
is great for getting a nicely-formatted preview of a data table
(defaulting to the first 5 rows and the last row).
contents:
- gt
- gt_preview
Expand Down Expand Up @@ -185,13 +185,13 @@ reference:
desc: >
An assortment of helper functions is available in the **gt** package.
The various `cells_*()` functions are used for targeting cells with the
`locations` argument in the `tab_footnote()`, `tab_style()`, and
`text_transform()` functions. The `cell_*()` functions are used
exclusively with `tab_style()`'s `style` argument. The `px()` &
`pct()` functions are useful there for specifying units in pixels or
percentages. The `md()` and `html()` helpers can used be during label
creation with the `tab_header()`, `tab_footnote()`, `tab_spanner()`,
`tab_stubhead_label()`, and `tab_source_note()` functions.
`locations` argument of `tab_footnote()`, `tab_style()`, and
`text_transform()`, `text_case_match()`, and `text_case_when()`.
The `cell_*()` functions are used exclusively with `tab_style()`'s `style`
argument. `px()` & `pct()` are useful there for specifying
units in pixels or percentages. The `md()` and `html()` helpers can used
be during label creation with `tab_header()`, `tab_footnote()`,
`tab_spanner()`, `tab_stubhead()`, and `tab_source_note()`.
contents:
- md
- html
Expand Down

0 comments on commit e97c62e

Please sign in to comment.