Rstudio Gt Versions Save

Easily generate information-rich, publication-quality tables from R

v0.2.2

3 years ago

New features

  • The new opt_table_font() function makes it possible to define a custom font for the entire gt table. The standard fallback fonts are still set by default but the font defined here will take precedence. You could still have different fonts in select locations in the table, and for that you would need to use tab_style() in conjunction with the cell_text() helper function. The new google_font() helper function provides an option for supplying a font available at the Google Fonts service (this is in addition to using system fonts in the font argument). Using the info_google_fonts() function will provide a table with a set of helpful font recommendations from the Google Fonts catalog. The new default_fonts() functions provides a helpful vector of system fallback fonts which works well when defining a vector of fonts. (#591)

  • The new opt_css() function makes allows for the addition of custom CSS to a gt table. This CSS will be added after the compiled CSS that gt generates automatically when the gt_tbl object is transformed to an HTML output table. You can supply css as a vector of lines or as a single string. The css() function has been re-exported from htmltools to make it easier to build CSS style declarations. (Also #591)

  • Setting the widths of table columns is now easier and more dependable with cols_width(). Widths can be expressed in units of pixels (easily set by use of the px() helper function), as percentages (where the pct() helper function is useful), or a mixture of the two. The function takes into consideration whether an overall table width has been provided with tab_options(table.width = ...). Providing pixel widths for all columns serves to override any table width defined (yielding columns with the exact widths specified). (#561)

  • There are new options for numeric formatting: (1) using significant figures (with n_sigfig in fmt_number), and (2) the ability to retain/drop trailing decimal marks (with drop_trailing_dec_mark in fmt_number(), fmt_percent(), and fmt_currency()). Thank you @drolejoel for the suggestion in #535! (#546).

  • The new scale_values argument for fmt_percent() makes it easy to use values that are already scaled (and just require the percent mark). Thank you @djohn215 for the suggestion in #559. (#565)

  • Font weights expressed as numeric values (e.g., 400, 600, etc.) in cell_text()'s weight argument now works properly. (#591)

Minor improvements and bug fixes

  • The data_color() function has been rewritten to improve performance (#543). (#576)

  • Restore the ability to have row striping in stub cells (with tab_option()'s row.striping.include_stub = TRUE). Thanks @gergness for creating PR #537, which prompted this final fix. (#564)

v0.2.1

4 years ago
  • summary_rows() and grand_summary_rows() no longer incorrectly calculate summary values in cases where rows aren't already sorted by group (#556).

  • Ensure compatibility with tibble 3.0.0 (#557).

  • Adapt tests to changes in dependent packages (#575)

v0.2.0.5

4 years ago
  • New package with 80 exported functions for building display tables