-
Notifications
You must be signed in to change notification settings - Fork 65
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 or wrong use of panderOptions? #233
Comments
Thanks for reporting this issue. Unfortunately, I do not have a quick fix -- as this is a rather complicated problem, and not sure about the optimal solution yet. In short, the function passed to ----- ------ ----- -------- --- ---
Survived No Yes
Class Sex Age
1st Male Child 0 5
Adult 118 57
Female Child 0 1
Adult 4 140
2nd Male Child 0 11
Adult 154 14
Female Child 0 13
Adult 13 80
3rd Male Child 35 13
Adult 387 75
Female Child 17 14
Adult 89 76
Crew Male Child 0 0
Adult 670 192
Female Child 0 0
Adult 3 20
----- ------ ----- -------- --- --- So 4 columns including strings and 2 columns including numbers, but the function defined above returns: > ifelse(sapply(ftable(Titanic, row.vars = 1:3), is.numeric), 'right', 'left')
[1] "right" "right" "right" "right" "right" "right" "right" "right" "right"
[10] "right" "right" "right" "right" "right" "right" "right" "right" "right"
[19] "right" "right" "right" "right" "right" "right" "right" "right" "right"
[28] "right" "right" "right" "right" "right" So this is wrong usage of But providing a more complex function to So two things to be done to resolve this issue:
I will try to come up with a solution for (2), can you please work on (1)? In the meanwhile, if you need an urgent solution and you do not have many tables to be printed automatically, you can manually set the |
Thanks, daroczig, for your as always fast and detailed reply. I will check (1) later, but manual formatting would be totally ok for me. However, all the experimenting started when I could not get it to work manual formatting with
This probably is due to (2), For my actual report, using global "right" is ok, so this is no urgent at all. But I know you are a perfectionist. |
I think you had a typo in the second example (not closing the parenthesis for the > pander(ftable(Titanic, row.vars = 1:3), justify = c(rep('left', 4), rep('right', 2)))
----- ------ ----- -------- --- ---
Survived No Yes
Class Sex Age
1st Male Child 0 5
Adult 118 57
Female Child 0 1
Adult 4 140
2nd Male Child 0 11
Adult 154 14
Female Child 0 13
Adult 13 80
3rd Male Child 35 13
Adult 387 75
Female Child 17 14
Adult 89 76
Crew Male Child 0 0
Adult 670 192
Female Child 0 0
Adult 3 20
----- ------ ----- -------- --- --- |
You were right, that error came up during experimenting. Here is what I see with your version:
|
The markdown looks OK to me, but the HTML/PDF rendered document is indeed off. I suspect something with the |
As a quick workaround, you can use the Quick demo on the workaround: > pander(ftable(Titanic, row.vars = 1:3), justify = c(rep('left', 4), rep('right', 2)), style = 'rmarkdown')
| | | | | | |
|:------|:-------|:------|:---------|----:|----:|
| | | | Survived | No | Yes |
| Class | Sex | Age | | | |
| 1st | Male | Child | | 0 | 5 |
| | | Adult | | 118 | 57 |
| | Female | Child | | 0 | 1 |
| | | Adult | | 4 | 140 |
| 2nd | Male | Child | | 0 | 11 |
| | | Adult | | 154 | 14 |
| | Female | Child | | 0 | 13 |
| | | Adult | | 13 | 80 |
| 3rd | Male | Child | | 35 | 13 |
| | | Adult | | 387 | 75 |
| | Female | Child | | 17 | 14 |
| | | Adult | | 89 | 76 |
| Crew | Male | Child | | 0 | 0 |
| | | Adult | | 670 | 192 |
| | Female | Child | | 0 | 0 |
| | | Adult | | 3 | 20 | Renders as: |
Works for me. I always had assumed that rmarkdown was the default in pander when run in knitr. |
@dmenne I think it's fixed with the above commit, please let me know how it works. |
Oh, and @RomanTsegelskyi, if you have some time, could you please have a look at the above commits and provide some feedback if you agree? |
Fine for me (I had already forgotten, because your workaround worked also). Thanks for your Christmas present. |
Using current version of pander from github with the panderOptions line gives an error; everything is fine without.
The text was updated successfully, but these errors were encountered: