vincentarelbundock / tinytable

Simple and Customizable Tables in `R`
https://vincentarelbundock.github.io/tinytable
GNU General Public License v3.0
196 stars 16 forks source link

Big mark separator won't work with whole numbers #256

Closed baarthur closed 4 months ago

baarthur commented 4 months ago

I have been puzzled for a while trying to understand why num_mark_big works with some data and not with others. I read the manual multiple times and couldn't find an explanation; trying to create a reprex, I think I found the culprit.

This table here won't behave as I want, either on the viewer pane or in the pdf:

tibble(
  population = c(1332037, 1299128, 805058, 206840, 698511)
) %>% 
  tt() %>% 
  format_tt(num_mark_big = " ", digits = 0, num_fmt = "decimal")

If at least one of the numbers isn't whole, it will display the big mark as intended:

tibble(
  population = c(1332037.3, 1299128, 805058, 206840, 698511)
) %>% 
  tt() %>% 
  format_tt(num_mark_big = " ", digits = 0, num_fmt = "decimal")

A simple workaround is to mutate my data, like df %>% mutate(population = population + 0.0001).

vincentarelbundock commented 4 months ago

Thanks for the report. Looks like num_big_mark was skipped on integers. Version ‘0.3.0.2’ on Github should fix that.