Closed longjp closed 1 year ago
This looks to me very much like a number_format problem.
Yes, indeed this is because the default number_format
is being used. Just set number_format
to NA
for the first row.
Huxtable's number recognition isn't perfect and here it is assuming that 1,003 is two numbers.
The interesting question is why number_format
is NA
for the original huxtable, but is set to "%.3g"
for the inserted row. The answer can be found in the "Automatic formatting" section of ?hux
.
One possible issue raised is that insert_row
and similar functions might want to apply autoformat
.
Thank you. That fixed it.
The insert_row function may alter text in the insertion. I came across this problem when trying to convert gtsummary tables into huxtables. Thank you to @ddsjoberg for the MWE below. Note that we try to insert "stat_1 = "A, N = 1,003" but the number 1,3 appear (two 0's deleted).