Closed jarbet closed 1 year ago
@jarbet, does |> with(pander::pander(ftab))
solve your issue? You need pander
package to be installed.
Print-screen from rendered Quarto (newer generation or Rmd) document:
For more details on why this solution works, you may investigate the following results:
your_table |> names()
your_table |> with(ftab) # your_table$ftab
your_table |> with(ftab) |> class()
@jarbet, does
|> with(pander::pander(ftab))
solve your issue? You needpander
package to be installed.
Yes, pander
works for me, although it seems less customizable than other table packages (e.g. kableExtra
, flextable
).
For example, I can't figure out how to add a vertical line to the left of area
column, or to add lines to separate the Sum
column and row (e.g. virtical line to left of Sum column, horizontal line above Sum row)
Also, how did you alternative the color of your rows? My table has an all white background when knitting to HTML in Rmarkdown:
tab <- table(driver = d.pizza$driver, area = d.pizza$area)
tab <- PercTable(tab, col.vars = 2, margins = c(1,2))
pander(tab$ftab)
pander
creates a multi-row Markdown table that then is rendered to any
other format by pandoc
(in your case, to HTML). So for HTML, try a custom
CSS code. You may create a CSS code block at the begining of your Rmd/qmd
file and write your CSS code there or create a separate a CSS file. I
usualy create a hidden CSS block, when a single HTML document needs
customization.
Website design is out of scope for DescTools
. But striped tables are very
common, so you can easily find more information on that elsewhere.
If you like a more detailed answer, open the same question on StackOverflow and add link here.
2023 bal. 12, tr 03:37, Jaron Arbet @.***> rašė:
@jarbet https://github.com/jarbet, does |> with(pander::pander(ftab)) solve your issue? You need pander package to be installed.
Yes, pander works for me, although it seems less customizable than other table packages (e.g. kableExtra, flextable).
For example, I can't figure out how to add a vertical line to the left of area column, or to add lines to separate the Sum column and row (e.g. virtical line to left of Sum column, horizontal line above Sum row)
Also, how did you alternative the color of your rows? My table has an all white background when knitting to HTML in Rmarkdown:
tab <- table(driver = d.pizza$driver, area = d.pizza$area) tab <- PercTable(tab, col.vars = 2, margins = c(1,2)) pander(tab$ftab)
[image: image] https://user-images.githubusercontent.com/103967480/231317693-b2aac7de-8edf-4654-8a9c-3a99351abf53.png
— Reply to this email directly, view it on GitHub https://github.com/AndriSignorell/DescTools/issues/110#issuecomment-1504337275, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADBC43D77MYXUPSTD7NLCM3XAX2M5ANCNFSM6AAAAAAW2S5TMI . You are receiving this because you commented.Message ID: @.***>
pander
creates a multi-row Markdown table that then is rendered to any other format bypandoc
(in your case, to HTML). So for HTML, try a custom CSS code. You may create a CSS code block at the begining of your Rmd/qmd file and write your CSS code there or create a separate a CSS file. I usualy create a hidden CSS block, when a single HTML document needs customization. Website design is out of scope forDescTools
. But striped tables are very common, so you can easily find more information on that elsewhere. If you like a more detailed answer, open the same question on StackOverflow and add link here. 2023 bal. 12, tr 03:37, Jaron Arbet @.***> rašė:
Sounds good. Thanks for your prompt replies in addressing both my issues!
I used Quarto, not R Markdown. I think, in Quarto table is striped by default.
I used Quarto, not R Markdown. I think, in Quarto table is striped by default.
Interesting. I have been meaning to switch over to Quarto, especially for the presentations. The Revealjs format has a lot of cool features.
This gives me 1 more reason to switch though lol.
@jarbet, if your issue is solved, please, close this thread.
Rather than
print
aPercTable
object, is there a way to render it as HTML in Rmarkdown?For example, suppose I want to render this table as HTML in RMarkdown:
Created on 2023-04-11 by the reprex package (v2.0.1)