rstudio / rmarkdown-cookbook

R Markdown Cookbook. A range of tips and tricks to make better use of R Markdown.
https://bookdown.org/yihui/rmarkdown-cookbook/
581 stars 224 forks source link

More packages for creating tables #298

Open yihui opened 3 years ago

yihui commented 3 years ago

I just saw the tablesgg package this morning from @rrprf: https://github.com/rrprf/tablesgg Drawing tables as graphics is an interesting idea (albeit probably not completely new, e.g. Figure 12.1 in the knitr book). If the priority is consistency of the appearance of tables across all Rmd output formats (PDF, HTML, Word, etc.), I guess this is one of the very few robust ways to go.

Anyway, I think it's definitely worth mentioning this package in the section https://bookdown.org/yihui/rmarkdown-cookbook/table-other.html.

cderv commented 3 years ago

consistency of the appearance of tables across all Rmd output formats (PDF, HTML, Word, etc.)

About this, flextable now support PDF in addition to HTML, Word and PowerPoint https://twitter.com/DavidGohel/status/1331620893349601282?s=20

This will require an update in the book

yihui commented 3 years ago

Oh yeah. I saw that tweet a few days ago. flextable and huxtable have looked the most promising in my eyes, which is why I put them in the first bullet in the list.

rrprf commented 3 years ago

Thanks for your note!  I agree that graphics is the easiest way to get consistent appearance across output formats.

One thing I'd like to highlight about tablesgg is that it uses a different conceptual model for tables compared to packages such as flextable and huxtable.  In the latter, essentially 'table = data frame listing + styling'.  tablesgg has a more formal model:  'table = (one or more row variables) (one or more column variables) + (text for each combination of rowcolumn variable values)'.   Since the package is aware of that structure it can do more automatic styling than would otherwise be possible.  There's more about it in the vignette.

Best, Richard

On 12/7/20 10:37 AM, Yihui Xie wrote:

I just saw the tablesgg package this morning from @rrprf https://github.com/rrprf: https://github.com/rrprf/tablesgg Drawing tables as graphics is an interesting idea (albeit probably not completely new, e.g. Figure 12.1 in the knitr book https://www.google.com/books/edition/Dynamic_Documents_with_R_and_knitr/lpTYCQAAQBAJ?hl=en&gbpv=1&bsq=grid%20table). If the priority is consistency of the appearance of tables across all Rmd output formats (PDF, HTML, Word, etc.), I guess this is one of the very few robust ways to go.

Anyway, I think it's definitely worth mentioning this package in the section https://bookdown.org/yihui/rmarkdown-cookbook/table-other.html.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/yihui/rmarkdown-cookbook/issues/298, or unsubscribe https://github.com/notifications/unsubscribe-auth/AR7JBTZMY6PMWS7IOZEGT53STTZDBANCNFSM4UQUALVQ.