Given the following example:
library(pander)
tableAbs <- Titanic[1, 1, , ]
tablePct <- round(prop.table(tableAbs) * 100, 2)
table <- cbind(tableAbs, tablePct)
pander(table)
----------------------------------
No Yes No Yes
----------- ---- ----- ----- -----
**Child** 0 5 0 2.78
**Adult** 118 57 65.56 31.67
----------------------------------
I would like to keep all trailing zeros on that 0
percentage over there, so this is what I do:
panderOptions("keep.trailing.zeros", TRUE)
pander(table)
------------------------------------
No Yes No Yes
----------- ------ ----- ----- -----
**Child** 0.00 5.00 0.00 2.78
**Adult** 118.00 57.00 65.56 31.67
------------------------------------
The problem is now that even the absolute frequencies have .00
attached to them. Since those are natural numbers, it makes little sense to keep those trailing zeros. How do I do this?