If you have to create complicated tables (e.g., with certain cells spanning across multiple columns/rows), you will have to take the aforementioned issues into consideration. For simple tables, kable() should suffice. Therefore, anything that is designed to format for HTML or LaTeX. I am able to create the tables quite easily using ftable (), but they are not formatted well for printing in markdown. When writing out an HTML table, the caption must be written in the tag. I am trying to create a table in rmarkdown with kable and kableExtra and I want to put greek letters in the addheaderabove function. I am trying to use R markdown to create a report that contains 3-way contingency tables. You have to be very careful about the portability of the table generating function: it should work for both HTML and LaTeX output automatically, so it must consider the output format internally (check knitr::opts_knit$get('')). If you decide to use other R packages to generate tables, you have to make sure the label for the table environment appears in the beginning of the table caption in the form (\#label) (again, label must have the prefix tab:). To be able to cross-reference a Markdown table, it must have a labeled caption of the form Table: (\#label) Caption here, where label must have the prefix tab:, e.g., tab:simple-table. You can use any types of Markdown tables in your document. What knitr::kable() generates is a simple table like this: Pandoc supports several types of Markdown tables, such as simple tables, multiline tables, grid tables, and pipe tables. Knitr :: kable( iris, longtable = TRUE, booktabs = TRUE, caption = 'A table generated by the longtable package.' ) TABLE 2.4: A table generated by the longtable package.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |