| Title: | Create GT Tables in blockr |
|---|---|
| Description: | This package provides an interface to the GT R package to create GT tables in blockr. |
| Authors: | Michael Page [aut, cre] |
| Maintainer: | Michael Page <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 0.0.0.9000 |
| Built: | 2026-07-16 07:47:25 UTC |
| Source: | https://github.com/cynkra/blockr.gt |
Creates a new GT block with inputs for title, subtitle, and footnotes. This block provides an interface for a basic GT table.
new_basic_gt_block( title = character(), subtitle = character(), footnotes = character(), alignment = "center", ... )new_basic_gt_block( title = character(), subtitle = character(), footnotes = character(), alignment = "center", ... )
title, subtitle, footnotes
|
Initial text for each field (character). All default to empty and accept markdown formatting. |
alignment |
The alignment of the title and subtitle elements in the table header. |
... |
Forwarded to |
A basic gt block object that can be used with the serve function.
## Not run: serve(new_basic_gt_block(title = "test"), data = list(data = head(mtcars))) ## End(Not run)## Not run: serve(new_basic_gt_block(title = "test"), data = list(data = head(mtcars))) ## End(Not run)
Color targeted cells in a GT block.
new_colour_gt_block( columns = numeric(), rows = character(), direction = character(), method = character(), palette = character(), bins = integer(), quantiles = integer(), alpha = numeric(), reverse = logical(), apply_to = character(), ... )new_colour_gt_block( columns = numeric(), rows = character(), direction = character(), method = character(), palette = character(), bins = integer(), quantiles = integer(), alpha = numeric(), reverse = logical(), apply_to = character(), ... )
columns |
The columns to which cell data color operations are constrained. |
rows |
In conjunction with columns, we can specify which rows should form a constraint for cell data color operations. Defaults to everything. |
direction |
Should the color computations be performed column-wise (default) or row-wise? Defeaults to colour down columns. |
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. |
palette |
Name of the colour palette to use. |
bins |
Number of bins to use when method is "bin". |
quantiles |
Number of equal-sized quantiles to use when method is "quantile". |
alpha |
Transparency level for colors. |
reverse |
Logical indicating whether colors should be computed in reverse order. |
apply_to |
Whether colors should fill the cell background or the text. |
... |
Forwarded to |
A gt block with additional cell colouring.
## Not run: serve(new_colour_gt_block(), data = list(gt_obj = gt(head(mtcars)))) ## End(Not run)## Not run: serve(new_colour_gt_block(), data = list(gt_obj = gt(head(mtcars)))) ## End(Not run)
This block takes a gt table object and saves it to file in the specified format(s). Supports HTML, PDF, and PNG output formats.
new_save_gt_block(format = "pdf", expand = 10, ...)new_save_gt_block(format = "pdf", expand = 10, ...)
format |
Vector of formats to save ("html", "pdf", "png") |
expand |
Numeric, expansion factor for PNG output (default 10) |
... |
Forwarded to |
Invisibly returns NULL, called for side effects
## Not run: serve(new_save_gt_block(), data = list(gt_obj = gt(mtcars))) ## End(Not run)## Not run: serve(new_save_gt_block(), data = list(gt_obj = gt(mtcars))) ## End(Not run)
Add a spanner to a gt table
new_spanner_gt_block(label = character(), columns = character(), ...)new_spanner_gt_block(label = character(), columns = character(), ...)
label |
The text to use for the spanner label. Accepts markdown formatted text. |
columns |
The columns to serve as components of the spanner. |
... |
Forwarded to |
A gt block object with an added spanner.
## Not run: serve(new_spanner_gt_block(), data = list(gt_obj = gt(mtcars))) ## End(Not run)## Not run: serve(new_spanner_gt_block(), data = list(gt_obj = gt(mtcars))) ## End(Not run)
Style a GT block using one of six prebuilt defaults with further options to control the table colour and row striping.
new_style_gt_block(style = 1, color = "gray", striping = "yes", ...)new_style_gt_block(style = 1, color = "gray", striping = "yes", ...)
style |
Numeric from 1 to 6 indicating which prebuilt default to use. |
color |
One of "blue", "cyan", "pink", "green", "red", and "gray". |
striping |
Logical indicating whether optional row striping should be enabled. |
... |
Forwarded to |
A styled gt block object that can be used with the serve function.
## Not run: serve(new_style_gt_block(), data = list(gt_obj = gt(head(mtcars)))) ## End(Not run)## Not run: serve(new_style_gt_block(), data = list(gt_obj = gt(head(mtcars)))) ## End(Not run)