Skip to content

Add options for sig figs / inclusion of trailing dec marks#546

Merged
rich-iannone merged 10 commits intomasterfrom
sigfig-formatting
Jun 22, 2020
Merged

Add options for sig figs / inclusion of trailing dec marks#546
rich-iannone merged 10 commits intomasterfrom
sigfig-formatting

Conversation

@rich-iannone
Copy link
Member

@rich-iannone rich-iannone commented Apr 15, 2020

This adds the n_sigfig arg to the fmt_number() function and the drop_trailing_dec_mark arg to the fmt_number(), fmt_percent(), and fmt_currency() functions.

The significant figures method uses a combination of the signif() and formatC() functions to ensure compliance with modern significant digit display rules.

The option to retain a decimal mark (here, with drop_trailing_dec_mark) is often seen in scientific literature and in statistical summary tables. If drop_trailing_dec_mark is changed from the default value, it displays the otherwise implicit decimal mark (even if there are no decimal figures required for display).

Fixes: #535

@rich-iannone rich-iannone marked this pull request as ready for review April 16, 2020 18:04
* master:
  pkgdown fixes (#551)
  Use GitHub Actions (#550)
Also, update tests for significant figures formatting.
@rich-iannone rich-iannone requested a review from jcheng5 April 24, 2020 20:30
jcheng5
jcheng5 previously approved these changes Apr 27, 2020
jcheng5
jcheng5 previously approved these changes Apr 29, 2020
* master:
  Fix issues with defining column widths in `cols_width()` (#561)
  Add `scale_values` arg to `fmt_percent()` (#565)
  Restore row striping option in stub cells (`row.striping.include_stub = TRUE`) (#564)
  Refactor `data_color()` so that it executes faster (#576)
  Update R-CMD-check.yaml (#599)
  Release gt 0.2.1 (#588)
  Ensure that row ordering doesn't affect summary row calculations (#556)
  Update failing example (#586)
  Remove test of scales behaviour
  Squelch warnings from tibble 3.0.0/3.0.1 (#557)
  Bump cache on pkgdown.yaml for GH workflow (#570)
  Update GH Actions workflow for R CMD check (#568)
  Update Description of package to be less confusing (#569)
@rich-iannone rich-iannone merged commit 721c9a5 into master Jun 22, 2020
@rich-iannone rich-iannone deleted the sigfig-formatting branch June 22, 2020 20:32
rich-iannone added a commit that referenced this pull request Oct 13, 2020
* master:
  Rewrite of RTF building functions and `as_rtf()` (#638)
  v0.2.2 Release Candidate (#629)
  Settable font options (#591)
  Add options for sig figs / inclusion of trailing dec marks (#546)
  Fix issues with defining column widths in `cols_width()` (#561)
  Add `scale_values` arg to `fmt_percent()` (#565)
  Restore row striping option in stub cells (`row.striping.include_stub = TRUE`) (#564)
  Refactor `data_color()` so that it executes faster (#576)
  Update R-CMD-check.yaml (#599)
  Release gt 0.2.1 (#588)
  Ensure that row ordering doesn't affect summary row calculations (#556)
rich-iannone added a commit that referenced this pull request Oct 25, 2020
* master: (30 commits)
  Spanner alignment correction (#662)
  PEN currency fix (#663)
  Fix for `gtsave()` when saving an image and specifying a `path` value (#592)
  Rewrite of RTF building functions and `as_rtf()` (#638)
  v0.2.2 Release Candidate (#629)
  Settable font options (#591)
  Add options for sig figs / inclusion of trailing dec marks (#546)
  Fix issues with defining column widths in `cols_width()` (#561)
  Add `scale_values` arg to `fmt_percent()` (#565)
  Restore row striping option in stub cells (`row.striping.include_stub = TRUE`) (#564)
  Refactor `data_color()` so that it executes faster (#576)
  Update R-CMD-check.yaml (#599)
  Release gt 0.2.1 (#588)
  Ensure that row ordering doesn't affect summary row calculations (#556)
  Update failing example (#586)
  Remove test of scales behaviour
  Squelch warnings from tibble 3.0.0/3.0.1 (#557)
  Bump cache on pkgdown.yaml for GH workflow (#570)
  Update GH Actions workflow for R CMD check (#568)
  Update Description of package to be less confusing (#569)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add significant figures to number formatting

2 participants