The kableExtra package is also compatible with LaTeX. If you are using a PDF format (common in math, physics, theoretical statistics and other math-heavy fields), you can write LaTeX code directly in Quarto, which means you can write tables using any of the LaTeX packages you want. HTML has the special power to generate interactive tables using packages like and. The kableExtra package is basically an extension of kable to have a lot of Extra features for making nicer tables. R has many packages for generating HTML tables, including the easy-to-use kableExtra. Any table you can see on the internet is made with HTML (and sometimes CSS and JavaScript). HTML is the most flexible format for generating tables. ![]() Because they generate Markdown text from code, they should work with Quarto regardless of the output format you use. Both of these are decently customizable and work well for a lot of cases. ![]() Remember that Quarto runs on Markdown, so the simplest option is to use a Markdown table.Īlthough you can make those by hand, you shouldn’t! There are a few functions that can make simple Markdown tables for you, including knitr::kable(), and pander::pandoc.table(). However, tables are not so easy – because they consist of just text and grid lines (usually), they need to be converted into a specific format for Quarto to use, and the best format to use depends on what output you need Quarto to produce. Visualizations are somewhat easy for Quarto to use, because they are always some type of image file (PNG, JPEG, etc.). Of course, if all you need is a simple contigency table, the table() function works quite well, although the result will not look very nice in your Quarto output. However, the table() function has very limited uses, and basically only works for simple contingency tables. Since you already learned about the plot() function, you might think the table() function can help you get started in base R. If you want to see some nice R-produced tables, you can check out the Posit community table gallery or the R graph gallery table section. In addition to being reproducible, making your tables with R and using them in Quarto solves one extremely frustrating problem: if your table is reproducible with code, whenever you update your data or analysis, you can rerun the code to get a new table, instead of recalculating all the cells by hand and typing them into a word document again! While the R ecosystem for making tables is less mature than the data visualization ecosystem, there are many packages for making both simple and publication-ready reproducible tables. Whatever the case is, you will need to make tables with your data at some point in your life. Examples include “Table 1” in epidemiology papers, containing demographic statistics univariate summary statistics and some contingency tables.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |