Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: columns mixed up with emphasize.strong.cols #34

Closed
zkamvar opened this issue May 12, 2013 · 5 comments
Closed

Bug: columns mixed up with emphasize.strong.cols #34

zkamvar opened this issue May 12, 2013 · 5 comments

Comments

@zkamvar
Copy link

zkamvar commented May 12, 2013

Your version of pander is awesome and has helped me a lot with my reports, but there is a problem with the argument emphasize.strong.cols in the pandoc.table() function and I thought I should bring it to your attention. If the user specifies more than one column, the result is that the columns are mixed up. Example below:


library(devtools)
install_github('pander', 'Rapporter')
ex <- matrix(1:100, 10, 10)
pandoc.table(ex, style='rmarkdown')
pandoc.table(ex, style='rmarkdown', emphasize.strong.cols = 2:3)

You can see the differences between the two tables below:

1 11 21 31 41 51 61 71 81 91
2 12 22 32 42 52 62 72 82 92
3 13 23 33 43 53 63 73 83 93
4 14 24 34 44 54 64 74 84 94
5 15 25 35 45 55 65 75 85 95
6 16 26 36 46 56 66 76 86 96
7 17 27 37 47 57 67 77 87 97
8 18 28 38 48 58 68 78 88 98
9 19 29 39 49 59 69 79 89 99
10 20 30 40 50 60 70 80 90 100
1 11 16 31 41 51 61 71 81 91
2 21 26 32 42 52 62 72 82 92
3 12 17 33 43 53 63 73 83 93
4 22 27 34 44 54 64 74 84 94
5 13 18 35 45 55 65 75 85 95
6 23 28 36 46 56 66 76 86 96
7 14 19 37 47 57 67 77 87 97
8 24 29 38 48 58 68 78 88 98
9 15 20 39 49 59 69 79 89 99
10 25 30 40 50 60 70 80 90 100

This is also observed with data frames.

@daroczig
Copy link
Member

Thank you very much for reporting this bug and also giving details with a reproducible minimal example.
I hope this is fixed with the above referenced commit, but please verify.

@zkamvar
Copy link
Author

zkamvar commented May 12, 2013

Verification that it works with given examples in multiple columns. Unfortunately it has brought up another bug:

> ex <- matrix(1:100, 10, 10)
> pandoc.table(data.frame(ex), style='rmarkdown', emphasize.strong.cols = 2)
Error in `[<-.data.frame`(`*tmp*`, , emphasize.strong.cols, value = c("**11**",  : 
  replacement has 1 row, data has 10

This is only a problem when a single column is selected. Would a possible solution be to transpose only if the length of emphasize.cols is greater than 1?

@daroczig
Copy link
Member

Sorry for such lame "fix" yesterday night, I should have guessed that a quickfix like that would not work at 3am :)
Even the automated tests showed that something is wrong: https://travis-ci.org/Rapporter/pander/builds/7089983

I've just pushed another commit that should resolve this issue. Please verify and feel free to reopen the issue if the problem would persist.

@zkamvar
Copy link
Author

zkamvar commented May 12, 2013

Fix verified. Thanks!

@daroczig
Copy link
Member

I am really happy to hear that, thank you very much for reporting back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants