Rapporter / pander

An R Pandoc Writer: Convert arbitrary R objects into markdown
http://rapporter.github.io/pander/
Open Software License 3.0
294 stars 66 forks source link

keep.trailing.zeros creates error in pander.table #371

Open couthcommander opened 2 months ago

couthcommander commented 2 months ago

I have a three-dimensional table. When passed to pander with "keep.trailing.zeros" set to TRUE, pandoc.table.return fails because "justify" and "t.width" are not the same. (sorry my simple example uses integers - I can change to floats and same error results)

> x=structure(c(70L, 52L, 70L, 28L, 303L, 205L, 477L, 82L, 96L, 26L, 
    172L, 16L), dim = c(2L, 2L, 3L), dimnames = list(female = c("Male", 
    "Female"), full = c("Assist/Assoc", "Full"), field = c("Arts", 
    "Other", "Prof")), class = c("xtabs", "table"))
> x
, , field = Arts

        full
female   Assist/Assoc Full
  Male             70   70
  Female           52   28

, , field = Other

        full
female   Assist/Assoc Full
  Male            303  477
  Female          205   82

, , field = Prof

        full
female   Assist/Assoc Full
  Male             96  172
  Female           26   16

> pander(x)

-------- -------------- ------- ------ ------- ------
                         field   Arts   Other   Prof 

 female       full                                   

  Male    Assist/Assoc            70     303     96  

              Full                70     477    172  

 Female   Assist/Assoc            52     205     26  

              Full                28     82      16  
-------- -------------- ------- ------ ------- ------

> pander(x, keep.trailing.zeros = TRUE)
Error in pandoc.table.return(...) : 
  Wrong number of parameters (6 instead of *3*) passed: justify