![]() ![]() knitr::kable(head(iris), booktabs = TRUE,Ĭaption = 'First six rows of the iris data in the package datasets.') Table 5.1: First six rows of the iris data in the package datasets. Another simple example of table generation by knitr::kable is given in the following code chunk. Table 3.1 was, in fact, generated by function knitr::kable. Tables can be similarly generated by a code chunk within the source document. At last but not least, in Section 9, we point readers to some external resources for further reading and more advanced usage of bookdown. Several example HTML widgets and Shiny applications are given in Section 7 and Section 8, respectively. A brief demonstration of a code chunk is given in Section 6. The generation of tables and other R objects is discussed in Section 5. Some examples for reproducing figures and including existing figures are given in Section 4. The rest of this project template is organized as follows: In Section 2 and Section 3, we present examples of writing mathematical equations, and mathematical environments, such as theorem, lemma, and definition, etc., respectively. Readers are encouraged to skim the PDF or HTML output, and have a closer look at the source document of this template directly. However, this is not intended as a tutorial of R Markdown or the bookdown. Instead of providing a minimal but non-informative template framework, we review most of the basic syntax of writing a single R Markdown document With the power of the bookdown with examples. ![]() Fortunately, the arrival of the package bookdown (Xie 2017) provides a much easier and more consistent syntax for cross-referencing. Usually extra packages, such as kfigr (Koohafkan 2015), and extra efforts were needed for automatic and satisfactory cross-referencing. ![]() In addition, it is in favor of reproducible studies, which have been receiving increasing attention in modern research.Ĭross-reference of mathematical equations, tables, and figures used to be a challenge when using R markdown. The benefits of setting up a template in R Markdown are its simple syntax and flexible output format with the help of pandoc. However, it can also be used as a general template in R Markdown for a single document. Once created, templates are easily accessed within RStudio, and will appear within the “New R Markdown” window as shown in Figure 17.1.This document is designed as a template for data science lab projects. For example, you can add a department field to be included within your title page. Updating the default YAML settings to include standard fields for title, author, date, or default output options.Ĭustomizing the layout of the output document by adding additional fields to the YAML metadata. ![]() Some additional examples of where a template could be used include:Ĭreating a company branded R Markdown template that includes a logo and branding colors. The rticles package in Chapter 13 is a good example of custom templates for a range of journals. In fact, you can create custom document templates by yourself, which can be useful if you need to create a particular type of document frequently or want to customize the appearance of the final report. When you create a new R Markdown document from the RStudio menu File -> New File -> R Markdown, you will see a default example document (a template) in the RStudio editor.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |