How can I keep the pander from dropping trailing zeros?

How can I make a pander discard trailing zeros when I simultaneously tell it to round values ​​above their corresponding number of significant digits?

In the following reproducible example, I am 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"))

However i get

------------
 Gender   p 
-------- ---
 Female   0 

  Male    0 
------------

But I want to get

----------------
 Gender      p 
-------- -------
 Female   0.0000 

  Male    0.0000
----------------

How can i do this?

** PS: I know this question , but it does not solve my problem. *

: , , , , , , - . NicE ( rawr ), , , .

+4
1

pander (, pandoc.table) round , ., , :

> round(c(4.342e-06, 1.325e-05), 4)
[1] 0 0

, . , , , , :

> round(c(4.342e-06, 1.325e-05), 5)
[1] 0e+00 1e-05

, :) , . :

> pander(matrix((c(4.342e-06, 1.325e-05))), round = 5)

-----
0e+00

1e-05
-----

> pander(matrix((c(4.342e-06, 1.325e-04))), round = 5)

-------
0.00000

0.00013
-------

, pander , - , ( pander ) , , @NicE.

0

Source: https://habr.com/ru/post/1599475/


All Articles