How can I keep pander from dropping the trailing zeros when I'm simultaneously telling it to round values above their respective number of significant figures?
In the following reproducible example, I'm trying to round a column of p-values for two hypothetical variables (male and female).
require(pander)
Gender <- c("Female", "Male")
p <- c(4.342e-06, 1.325e-05)
table <- data.frame(Gender, p)
panderOptions('round', 4)
panderOptions('keep.trailing.zeros', TRUE)
pandoc.table(table,
round = panderOptions("round"),
keep.trailing.zeros = panderOptions("keep.trailing.zeros"))
What I get, however, is
------------
Gender p
-------- ---
Female 0
Male 0
------------
But what I want to get is
----------------
Gender p
-------- -------
Female 0.0000
Male 0.0000
----------------
How can I make that happen?
**PS: I'm aware of this question, but it does not solve my problem.*
Edit: I'm also aware of the question here, but the solution there does exactly what I'm trying to keep from happening here, that is, dropping the trailing zeros when I'm trying to round to value that does not contain any significant figures for all my variables. NicE has a solution (which rawr also gave in the aforementioned previous question), but they require converting the values to characters in addition to stacking up extra code, which I would like to avoid if possible.