![]() ![]() In terms of doing spatial data, I believe GUI is important. Interactively present spatial data with mapview As explicit as the argument names, bold changes the text in that column to bold font, while border_right adds a border (a thicker, darker line) to the right of that column.Īnd here you have the final formatted table. column_spec allows tweaking specific columns by providing the column number and the layout specifications. Differentiating between this column and other “data columns” looks better (again, my personal opinion). The first columns usually refers to the name of each unit of analysis. ![]() Table %>% knitr :: kable ( caption = "TABLE NAME", digits = 2, format.args = list ( big.mark = "," ), col.names = c ( "A", "B", "C", "D" ) ) %>% kable_styling ( bootstrap_options = c ( "striped", "hover" ), full_width = F ) %>% column_spec ( 1, bold = T, border_right = T ) And the code block below the options I usually use. KableExtra::kable_styling() and kableExtra::column_spec() are the two functions I use heavily. The most amazing thing about kableExtra is that most of its table features work for both HTML and PDF formats (e.g., making striped tables like the one in Figure 10.1). ![]() Since knitr::kable() is simple by design (please feel free to read this as “Yihui is lazy”), it definitely has a lot of missing features that are commonly seen in other packages, and kableExtra has filled the gap perfectly. ![]() The kableExtra package ( Zhu 2021) is designed to extend the basic functionality of tables produced using knitr::kable() (see Section 10.1). The differentiation between these two already explained in the kableExtra sub-chapter of R-markdown Cookbook. I usually add a few tweaks to enhance the layout of the table using the functions available in the kableExtra package. While basic tables could be produced with the kable() function. R-markdown Cookbook has a whole chapter dedicated to format the tables in Rmd. Add an out.extra chunk option and specify the id of the generated plot.I would like to emphasise it by adding some additional CSS properties, say 1. One of the plots is special and important. I don’t want to involve in the war of arguing whether 11-10-2018 means 11th October 2018 or 10th November 2018.Īdd id tag and further style images Scenario To avoid ambiguity between the date number and the month number, I usually format the month using its full name. SIDENOTE: even though I am in line with xkcd that ISO 8601 is the best way to indicate date, not all viewers agree on this. the magical "%d %B, %Y" argument above) is also summarised in Chapter 4 of R Markdown Cookbook. The inline expression above calls R to get the current time ( Sys.time())when the document is “knitted”, and then format the date ( format(Sys.time(), "%d %B, %Y")) to human readable format.Ī full table of POSIXct formats (i.e. Therefore, it is possible to write r expressions inside the YAML header. Knitr evaluates the r expressions (both inline and block) to create a markdown before passing it to pandoc to convert the markdown to HTML report. date : '`r format(Sys.time(), "%d %B, %Y")`' - Explanation This one-liner from Stack Overflow does the trick. To differentiate between them, it is needed to show the last updated date on the top of the document. The rmarkdown document is continuously updating that there will exist various verison of the report. Interactively present spatial data with mapviewĪutomatically update the last edited/updated date Scenario.Automatically update the last edited/updated date.Though, I may not have time to write many paragraphs. This list may be continuously updating, as I always learn new things about R. Here is a list of selected packages and functions I find extremely useful (for my routine works, at least). The details and flexibility of extending your Rmd is fully listed in the R Markdown Cookbook. I am always surprised many functions that I believe required manual edits the actually available as functions in knitr. Rmarkdown (and markdown) are crazily useful to generate documents. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |