-1

Here's what I'm getting:

> panderOptions('big.mark', ',')
> foo <- rbind(cancer, cancer); for(i in 1:8) foo <- rbind(foo, foo)
> pander(table(foo$ph.karno, foo$pat.karno))

-----------------------------------------------------
 &nbsp;    30    40   50   60   70   80    90    100 
--------- ----- ---- ---- ---- ---- ----- ----- -----
 **50**     0   512  512  512  512   512    0     0  

 **60**     0   512  512  2560 4608 1536    0     0  

 **70**   1,024  0   1024 4608 3072 3072  1536  1536 

 **80**     0    0    0   6144 6656 6656  10240 4608 

 **90**     0    0    0   1536 5120 10752 12288 7680 

 **100**    0    0    0    0   512  3584  6656  4096 
-----------------------------------------------------

I would like the comma delimiter to show up in the other columns too. How do I do that?

Gabi
  • 1,303
  • 16
  • 20
  • 2
    This was a bug in the package that I've [just fixed](https://github.com/Rapporter/pander/commit/96a262fd350493988433b996eb2affac1f697a6c), so the most recent version of `pander` installed from GH should work as expected. If you find any similar issues, please feel free to open a ticket directly on GH -- the chance that I bump into the problem is lot higher that way. – daroczig Jan 06 '16 at 07:49

1 Answers1

3

Best result I got (with t being your table call result):

> pander(format(t,big.mark=','))

----------------------------------------------------------
 &nbsp;    30    40   50    60    70     80     90    100 
--------- ----- ---- ----- ----- ----- ------ ------ -----
 **50**     0   512   512   512   512   512     0      0  

 **60**     0   512   512  2,560 4,608 1,536    0      0  

 **70**   1,024  0   1,024 4,608 3,072 3,072  1,536  1,536

 **80**     0    0     0   6,144 6,656 6,656  10,240 4,608

 **90**     0    0     0   1,536 5,120 10,752 12,288 7,680

 **100**    0    0     0     0    512  3,584  6,656  4,096
----------------------------------------------------------

I assume this is a bug in pander.table.return but I did not dig enough to get the root cause.

Edit: I found the reason, line 283 of the function there's a for loop calling sapply on each col, but once the first column has been processed, the full array of the table is converted to char as we bring in chars from the output of format.

Then the subsequent calls to format can't format the number as they've been coerced to char.

Code from pander.table.return giving this behavior:

for (j in 1:ncol(t)) {
  temp.t[, j] <- sapply(temp.t[, j], format, trim = TRUE, 
                        digits = digits[j], decimal.mark = decimal.mark, 
                        big.mark = big.mark)
}
Tensibai
  • 15,557
  • 1
  • 37
  • 57
  • 1
    The diagnosis is correct :) I've just pushed a [commit](https://github.com/Rapporter/pander/commit/96a262fd350493988433b996eb2affac1f697a6c), to fix this. – daroczig Jan 06 '16 at 07:50
  • @daroczig great :) Sorry I've been too lazy to search the github repo and open and issue. – Tensibai Jan 06 '16 at 07:52