4

im trying to get a lovely 3-way crosstable using ftable with pander. In general output is ok, but row and column names are all in quotation marks which isnt ideal.

example:

library(pander)
varA <-c("a","a","a","a","b","b")
varB <-c(1,2,1,2,1,2)
varC <-c(1,2,3,4,5,6)

tab1<-ftable(table(varA,varB,varC))
pander(tab1)

Im not sure how i can insert formated table so it wouldnt look awful (copy paste does some wierd things with it), but after knitring it looks like on screenshot below:

enter image description here

Thank in advance for your help.

Ronak Shah
  • 377,200
  • 20
  • 156
  • 213

1 Answers1

2

I think this was a bug, so thanks for reporting this -- hopefully fixed now:

> pander(tab1)

---- ---- ---- - - - - - -
          varC 1 2 3 4 5 6

varA varB                 

 a    1        1 0 1 0 0 0

      2        0 1 0 1 0 0

 b    1        0 0 0 0 1 0

      2        0 0 0 0 0 1
---- ---- ---- - - - - - -

enter image description here

Please try the development version installed from GitHub and feel free to report similar issues or any suggestion you may have in the GitHub issue tracker.

daroczig
  • 28,004
  • 7
  • 90
  • 124
  • Thank you, works like a charm, though i must say im little surprised. I assumed its something with ftable and not a bug in pander. I was trying to do the same with `print(xtable())` but i was getting same double quotations. – Maciej Karczewski Dec 07 '15 at 07:54
  • 1
    @MaciejKarczewski I think `xtable` also uses `format` in the background, which does the quoting -- see `xtable.format.args` option there. – daroczig Dec 07 '15 at 19:54