-
Notifications
You must be signed in to change notification settings - Fork 214
Decimal alignment with cols_align_decimal()
#1058
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
Conversation
I know some people who literally refuse to use anything but LaTeX tables exactly because of this feature! |
@domoritz Sorry to randomly tag you on this, but check out what's coming to quarto's tables soon! 😍 https://github.com/rstudio/gt/pull/1058/files#diff-0561d116b26297ef34a596107e310c46f00d108472133cc5468dc644fe0e124f |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks excellent.
😍 that's awesome. Thank you for randomly tagging me. |
This is great, @rich-iannone! It's fairly common, when using Do you think there's any way to address that combination of options (for example by (a) faking the decimal by imputing the Thanks! library(gt)
dplyr::tibble(
char = LETTERS[1:8],
num = c(1.2, -33.52, 9023.2, -283.527, 0.401, -123.1, NA, 41)) |>
gt() |>
tab_header("fmt_currency / accounting = TRUE / decimals = 0") |>
fmt_currency(num, accounting = TRUE, decimals = 0) |>
cols_align_decimal()
Created on 2022-10-13 with reprex v2.0.2 |
This adds the
cols_align_decimal()
function, which is to be used for lining up numeric values by the decimal mark. The function ensures that columns targeted are right-aligned, that accounting notation is supported, and that footnote marks don't interfere.Fixes: #139
Fixes: #144
Fixes: #560
Fixes: #673