Create TableAll gt tables begin with a call to |
|
---|---|
Create a gt table object |
|
Preview a gt table object |
|
Create or Modify PartsA gt table can contain a few useful parts for conveying additional information. These include a header (with a titles and subtitle), a footer (with footnotes and source notes), and additional areas for labels (row group labels, column spanner labels, the stubhead label). We can modify the look of table parts more generally with |
|
Add a table header |
|
Add a spanner column label |
|
Create column labels and spanners via delimited names |
|
Add a row group to a gt table |
|
Add label text to the stubhead |
|
Add a table footnote |
|
Add a source note citation |
|
Add custom styles to one or more cells |
|
Modify the table output options |
|
Format DataColumns of data can be formatted with the |
|
Format numeric values |
|
Format values to scientific notation |
|
Format values as a percentage |
|
Format values as currencies |
|
Format values as dates |
|
Format values as times |
|
Format values as date-times |
|
Format Markdown text |
|
Format by simply passing data through |
|
Format missing values |
|
Set a column format with a formatter function |
|
Perform targeted text transformation with a function |
|
Set data cell colors using a palette or a color function |
|
Modify ColumnsThe |
|
Set the alignment of columns |
|
Set the widths of columns |
|
Relabel one or more columns |
|
Move one or more columns to the start |
|
Move one or more columns to the end |
|
Move one or more columns |
|
Hide one or more columns |
|
Merge two columns to a value range column |
|
Merge two columns to a value & uncertainty column |
|
Merge data from two or more columns to a single column |
|
Modify RowsThe only function currently that modifies entire rows is the |
|
Modify the ordering of any row groups |
|
Add RowsThere are two functions that will add rows to a gt table: |
|
Add groupwise summary rows using aggregation functions |
|
Add grand summary rows using aggregation functions |
|
Helper FunctionsA small assortment of helper functions is available in the gt package. The various |
|
Interpret input text as Markdown-formatted text |
|
Interpret input text as HTML-formatted text |
|
Helper for providing a numeric value as pixels value |
|
Helper for providing a numeric value as percentage |
|
Location helper for targeting the table title and subtitle |
|
Location helper for targeting the table stubhead cell |
|
Location helper for targeting the column spanners |
|
Location helper for targeting the column labels |
|
Location helper for targeting row groups |
|
Location helper for targeting cells in the table stub |
|
Location helper for targeting data cells in the table body |
|
Location helper for targeting group summary cells |
|
Location helper for targeting cells in a grand summary |
|
Supply a custom currency symbol to |
|
Helper for defining custom text styles for table cells |
|
Helper for defining custom fills for table cells |
|
Helper for defining custom borders for table cells |
|
Adjust the luminance for a palette of colors |
|
Helper for creating a random |
|
Perform LaTeX escaping |
|
Get the LaTeX dependencies required for a gt table |
|
Image Addition FunctionsWe can add images into a gt table with the help of the |
|
Helper function for adding an image from the web |
|
Helper function for adding a local image |
|
Helper function for adding a ggplot |
|
Generate a path to a test image |
|
Table Option FunctionsWith the |
|
Option to modify the set of footnote marks |
|
Option to add or remove row striping |
|
Option to align the table header |
|
Option to use all caps in select table locations |
|
Option to set table lines to different extents |
|
Option to wrap an outline around the entire table |
|
Information FunctionsThese |
|
View a table with info on date styles |
|
View a table with info on time styles |
|
View a table with info on supported currencies |
|
View a table with info on supported locales |
|
View a table with info on color palettes |
|
DatasetsThe gt package is equipped with six datasets that come in all shapes and sizes. Use them to experiment with the package. Many examples in the internal help documents use these datasets to quickly demonstrate the key features of gt. |
|
Yearly populations of countries from 1960 to 2017 |
|
Twice hourly solar zenith angles by month & latitude |
|
Deluxe automobiles from the 2014-2017 period |
|
Daily S&P 500 Index data from 1950 to 2015 |
|
A year of pizza sales from a pizza place |
|
A toy example tibble for testing with gt: exibble |
|
Shiny FunctionsShiny is great for building interactive web apps with R. There’s really nothing quite like it. The gt package includes two functions that work nicely with Shiny: a table render function |
|
A gt display table render function for use in Shiny |
|
Create a gt display table output element for Shiny |
|
Export FunctionsThere may come a day when you need to export a gt table to some specific format. A great function for that is |
|
Save a gt table as a file |
|
Get the HTML content of a gt table |
|
Output a gt object as LaTeX |
|
Output a gt object as RTF |
|
Extract a summary list from a gt object |