Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update all arguments in docs of exported functions #1338

Merged
merged 39 commits into from
Jun 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
0f76dc4
Create extra.css
rich-iannone May 31, 2023
b970ca3
Update as_data_frame.R
rich-iannone May 31, 2023
e67c9aa
Update data_color.R
rich-iannone May 31, 2023
f5e13a7
Update export.R
rich-iannone May 31, 2023
8f82e42
Update format_data.R
rich-iannone May 31, 2023
bfbdb59
Update format_vec.R
rich-iannone May 31, 2023
e63d10b
Update gt.R
rich-iannone May 31, 2023
ab96648
Update gt_group.R
rich-iannone May 31, 2023
5de6601
Update gt_preview.R
rich-iannone May 31, 2023
391b15e
Update gt_split.R
rich-iannone May 31, 2023
91faeb0
Update helpers.R
rich-iannone May 31, 2023
323d3d5
Update image.R
rich-iannone May 31, 2023
fdfa93f
Update info_tables.R
rich-iannone May 31, 2023
e90a9f1
Update modify_columns.R
rich-iannone May 31, 2023
97a4462
Update opts.R
rich-iannone May 31, 2023
6f500f2
Update rows_add.R
rich-iannone May 31, 2023
5ad92a4
Update shiny.R
rich-iannone May 31, 2023
1263701
Update substitution.R
rich-iannone May 31, 2023
52dad85
Update summary_rows.R
rich-iannone May 31, 2023
ab4ee02
Update tab_create_modify.R
rich-iannone May 31, 2023
37e93a8
Update tab_remove.R
rich-iannone May 31, 2023
51b2dc6
Update tab_style_body.R
rich-iannone May 31, 2023
39ee4c4
Update text_transform.R
rich-iannone May 31, 2023
a481e36
Update help files using roxygen
rich-iannone May 31, 2023
6167ff0
Update export.R
rich-iannone Jun 1, 2023
9403100
Update gt_group.R
rich-iannone Jun 1, 2023
ce255b7
Update modify_columns.R
rich-iannone Jun 1, 2023
5409e1f
Update modify_rows.R
rich-iannone Jun 1, 2023
6a687e4
Update opts.R
rich-iannone Jun 1, 2023
4b8b7b2
Update shiny.R
rich-iannone Jun 1, 2023
06e9a40
Update substitution.R
rich-iannone Jun 1, 2023
dfb2699
Update summary_rows.R
rich-iannone Jun 1, 2023
bc61241
Update tab_create_modify.R
rich-iannone Jun 1, 2023
7d3a2b9
Update tab_remove.R
rich-iannone Jun 1, 2023
e195d5c
Update tab_style_body.R
rich-iannone Jun 1, 2023
6050422
Update text_transform.R
rich-iannone Jun 1, 2023
a9ee1d6
Update help files using roxygen
rich-iannone Jun 1, 2023
3b5ec1a
Update tab_create_modify.R
rich-iannone Jun 1, 2023
b3c4dd6
Update tab_header.Rd
rich-iannone Jun 1, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions R/as_data_frame.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,19 @@
#'
#' This facilitates conversion of the `gt_tbl` object to a data frame.
#'
#' @param x An object of class `gt_tbl`.
#' @param ... Any additional parameters.
#' @param x *The gt table data object*
#'
#' `obj:<gt_tbl>` --- **required**
#'
#' This is the **gt** table object that is commonly created through use of the
#' [gt()] function.
#'
#' @param ... *Optional parameters*
#'
#' `<multiple expressions>` --- (`optional`)
#'
#' Anything provided here in `...` will be passed to internal function calls
#' that can consume it.
#'
#' @keywords internal
#'
Expand Down
234 changes: 169 additions & 65 deletions R/data_color.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,76 +66,180 @@
#' without running into too many errors.
#'
#' @inheritParams fmt_number
#' @param columns,rows The columns and rows to which cell data color operations
#' are constrained.
#' @param direction Should the color computations be performed column-wise or
#' row-wise? By default this is set with the `"column"` keyword and colors
#' will be applied down columns. The alternative option with the `"row"`
#' keyword ensures that the color mapping works across rows.
#' @param target_columns For indirect column coloring treatments, we can supply
#' the columns that will receive the styling. The necessary precondition is
#' that we must use `direction = "column"`. If `columns` resolves to a single
#' column then we may use one or more columns in `target_columns`. If on the
#' other hand `columns` resolves to multiple columns, then `target_columns`
#' must resolve to the same multiple.
#' @param method A method for computing color based on the data within body
#' cells. Can be `"auto"` (the default), `"numeric"`, `"bin"`, `"quantile"`,
#' or `"factor"`. The `"auto"` method will automatically choose the
#' `"numeric"` method for numerical input data or the `"factor"` method for
#' any non-numeric inputs.
#' @param palette A vector of color names, the name of an **RColorBrewer**
#' palette, the name of a **viridis** palette, or a discrete palette
#' accessible from the **paletteer** package using the `<package>::<palette>`
#' syntax (e.g., `"wesanderson::IsleofDogs1"`). If providing a vector of
#' colors as a palette, each color value provided must either be a color name
#' (Only R/X11 color names or CSS 3.0 color names) or a hexadecimal string in
#' the form of `"#RRGGBB"` or `"#RRGGBBAA"`. If nothing is provided here, the
#' default R color palette is used (i.e., the colors from `palette()`).
#' @param domain The possible values that can be mapped. For the `"numeric"` and
#' `"bin"` methods, this can be a numeric range specified with a length of two
#' vector. Representative numeric data is needed for the `"quantile"` method
#' and categorical data must be used for the `"factor"` method. If `NULL` (the
#'
#' @param columns *Columns to target*
#'
#' `<column-targeting expression>` --- *default:* `everything()`
#'
#' The columns to which cell data color operations are constrained. Can either
#' be a series of column names provided in [c()], a vector of column indices,
#' or a select helper function. Examples of select helper functions include
#' [starts_with()], [ends_with()], [contains()], [matches()], [one_of()],
#' [num_range()], and [everything()].
#'
#' @param rows *Rows to target*
#'
#' `<row-targeting expression>` --- *default:* `everything()`
#'
#' In conjunction with `columns`, we can specify which of their rows should
#' form a constraint for cell data color operations. The default
#' [everything()] 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 select helper function. Examples of select
#' helper functions include [starts_with()], [ends_with()], [contains()],
#' [matches()], [one_of()], [num_range()], and [everything()]. We can also use
#' expressions to filter down to the rows we need (e.g., `[colname_1] > 100 &
#' [colname_2] < 50`).
#'
#' @param direction *Color computation direction*
#'
#' `singl-kw:[column|row]` --- *default:* `"column"`
#'
#' Should the color computations be performed column-wise or row-wise? By
#' default this is set with the `"column"` keyword and colors will be applied
#' down columns. The alternative option with the `"row"` keyword ensures that
#' the color mapping works across rows.
#'
#' @param target_columns *Indirect columns to target*
#'
#' `<row-targeting expression>` --- *default:* `NULL` `optional`
#'
#' For indirect column coloring treatments, we can supply the columns that
#' will receive the styling. The necessary precondition is that we must use
#' `direction = "column"`. If `columns` resolves to a single column then we
#' may use one or more columns in `target_columns`. If on the other hand
#' `columns` resolves to multiple columns, then `target_columns` must resolve
#' to the same multiple.
#'
#' @param method *Color computation method*
#'
#' `singl-kw:[auto|numeric|bin|quantile|factor]` --- *default:* `"auto"`
#'
#' A method for computing color based on the data within body cells. Can be
#' `"auto"` (the default), `"numeric"`, `"bin"`, `"quantile"`, or `"factor"`.
#' The `"auto"` method will automatically choose the `"numeric"` method for
#' numerical input data or the `"factor"` method for any non-numeric inputs.
#'
#' @param palette *Color palette*
#'
#' `vector<character>` --- *default:* `NULL` (`optional`)
#'
#' A vector of color names, the name of an **RColorBrewer** palette, the name
#' of a **viridis** palette, or a discrete palette accessible from the
#' **paletteer** package using the `<package>::<palette>` syntax (e.g.,
#' `"wesanderson::IsleofDogs1"`). If providing a vector of colors as a
#' palette, each color value provided must either be a color name (Only R/X11
#' color names or CSS 3.0 color names) or a hexadecimal string in the form of
#' `"#RRGGBB"` or `"#RRGGBBAA"`. If nothing is provided here, the default R
#' color palette is used (i.e., the colors from `palette()`).
#'
#' @param domain *Value domain*
#'
#' `vector<numeric|integer|character>` --- *default:* `NULL` (`optional`)
#'
#' The possible values that can be mapped. For the `"numeric"` and `"bin"`
#' methods, this can be a numeric range specified with a length of two vector.
#' Representative numeric data is needed for the `"quantile"` method and
#' categorical data must be used for the `"factor"` method. If `NULL` (the
#' default value), the values in each column or row (depending on `direction`)
#' value will represent the domain.
#' @param bins For `method = "bin"` this can either be a numeric vector of two
#' or more unique cut points, or, a single numeric value (greater than or
#' equal to `2`) giving the number of intervals into which the domain values
#' are to be cut. By default, this is `8`.
#' @param quantiles For `method = "quantile"` this is the number of equal-size
#' quantiles to use. By default, this is set to `4`.
#' @param levels For `method = "factor"` this allows for an alternate way of
#' specifying levels. If anything is provided here then any value supplied to
#' `domain` will be ignored. This should be a character vector of unique
#' values.
#' @param ordered For `method = "factor"`, setting this to `TRUE` means that the
#' vector supplied to `domain` will be treated as being in the correct order
#' if that vector needs to be coerced to a factor. By default, this is
#' `FALSE`.
#' @param na_color The color to use for missing values. By default (with
#' `na_color = NULL`) gray, `"#808080"`, will be used.
#' @param alpha An optional, fixed alpha transparency value that will be applied
#' to all of the `colors` provided (regardless of whether a color palette was
#' directly supplied or generated through a color mapping function).
#' @param reverse Should the colors computed operate in reverse order?
#' If `TRUE` then colors that normally change from red to blue will change in
#' the opposite direction. By default, this is `FALSE`.
#' @param fn A color-mapping function. The function should be able to take a
#' vector of data values as input and return an equal-length vector of color
#' values. The `col_*()` functions provided in the **scales** package (i.e.,
#'
#' @param bins *Specification of bin number*
#'
#' `scalar<numeric|integer>` --- *default:* `8`
#'
#' For `method = "bin"` this can either be a numeric vector of two or more
#' unique cut points, or, a single numeric value (greater than or equal to
#' `2`) giving the number of intervals into which the domain values are to be
#' cut. By default, this is `8`.
#'
#' @param quantiles *Specification of quantile number*
#'
#' `scalar<numeric|integer>` --- *default:* `4`
#'
#' For `method = "quantile"` this is the number of equal-size quantiles to
#' use. By default, this is set to `4`.
#'
#' @param levels *Specification of factor levels*
#'
#' `vector<character>` --- *default:* `NULL` (`optional`)
#'
#' For `method = "factor"` this allows for an alternate way of specifying
#' levels. If anything is provided here then any value supplied to `domain`
#' will be ignored. This should be a character vector of unique values.
#'
#' @param ordered *Use an ordered factor*
#'
#' `scalar<logical>` --- *default:* `FALSE`
#'
#' For `method = "factor"`, setting this to `TRUE` means that the vector
#' supplied to `domain` will be treated as being in the correct order if that
#' vector needs to be coerced to a factor. By default, this is `FALSE`.
#'
#' @param na_color *Default color for `NA` values*
#'
#' `scalar<character>` --- *default:* `NULL` (`optional`)
#'
#' The color to use for missing values. By default (with `na_color = NULL`),
#' the color gray (`"#808080"`) will be used. This option has no effect if
#' providing a color-mapping function to `fn`.
#'
#' @param alpha *Transparency value*
#'
#' `scalar<numeric|integer>(0>=val>=1)` --- *default:* `NULL` (`optional`)
#'
#' An optional, fixed alpha transparency value that will be applied to all of
#' the `colors` provided (regardless of whether a color palette was directly
#' supplied or generated through a color mapping function).
#'
#' @param reverse *Reverse order of computed colors*
#'
#' `scalar<logical>` --- *default:* `FALSE`
#'
#' Should the colors computed operate in the reverse order? If `TRUE` then
#' colors that normally change from red to blue will change in the opposite
#' direction.
#'
#' @param fn *Color-mapping function*
#'
#' `function` --- *default:* `NULL` (`optional`)
#'
#' A color-mapping function. The function should be able to take a vector of
#' data values as input and return an equal-length vector of color values. The
#' `col_*()` functions provided in the **scales** package (i.e.,
#' [scales::col_numeric()], [scales::col_bin()], and [scales::col_factor()])
#' can be invoked here with options, as those functions themselves return a
#' color-mapping function.
#' @param apply_to Which style element should the colors be applied to? Options
#' include the cell background (the default, given as `"fill"`) or the cell
#' text (`"text"`).
#' @param autocolor_text An option to let **gt** modify the coloring of text
#' within cells undergoing background coloring. This will result in better
#' text-to-background color contrast. By default, this is set to `TRUE`.
#' @param contrast_algo The color contrast algorithm to use when
#' `autocolor_text = TRUE`. By default this is `"apca"` (Accessible Perceptual
#' Contrast Algorithm) and the alternative to this is `"wcag"` (Web Content
#' Accessibility Guidelines).
#' @param colors Deprecated. Use the `fn` argument instead to provide a
#'
#' @param apply_to *How to apply color*
#'
#' `singl-kw:[fill|text]` --- *default:* `"fill"`
#'
#' Which style element should the colors be applied to? Options include the
#' cell background (the default, given as `"fill"`) or the cell text
#' (`"text"`).
#'
#' @param autocolor_text *Automatically recolor text*
#'
#' `scalar<logical>` --- *default:* `TRUE`
#'
#' An option to let **gt** modify the coloring of text within cells undergoing
#' background coloring. This will result in better text-to-background color
#' contrast. By default, this is set to `TRUE`.
#'
#' @param contrast_algo *Color contrast algorithm choice*
#'
#' `singl-kw:[apca|wcag]` --- *default:* `"apca"`
#'
#' The color contrast algorithm to use when `autocolor_text = TRUE`. By
#' default this is `"apca"` (Accessible Perceptual Contrast Algorithm) and the
#' alternative to this is `"wcag"` (Web Content Accessibility Guidelines).
#'
#' @param colors *[Deprecated] Color mapping function*
#'
#' `function` --- *default:* `NULL` (`optional`)
#'
#' This argument is deprecated. Use the `fn` argument instead to provide a
#' **scales**-based color-mapping function. If providing a palette, use the
#' `palette` argument.
#'
Expand Down
Loading