1 Introduction

This document offers a template to write your academic reports in RMarkdown.

Some R packages are requires: tidyverse, DT, kabble, kableExtra, knitr. If these packages are note installed, please run the following line in the R console:

install.packages("tidyverse")
install.packages("DT")
install.packages("kabble")
install.packages("kableExtra")
install.packages("knitr")

If you want to use this template, I assume that you are already familiar with both R and Markdown. I also assume that you know the basics of RStudio. If this is not the case, you might want to read (in French) this RMarkdown tutorial.

In addition, to be able to compile the document to get the final output in a PDF format, a LaTeX engine is required. A very simple way to get one is to exectue the following code in the R console:

tinytex::install_tinytex()

If you want to customize the theme, you can look in the following files: - for HTML documents: assets/style.css. - for PDF documents: assets/style_rapport_amu.css

2 Title of the First Section

It is easy to cite some documents thanks to natbib. As written in Athey and Imbens (2017), … There are multiple ways of citing document (Xie, Allaire, and Grolemund 2018). More details are listed in the RMarkdown tutorial.

The bib file is located in assets/biblio.bib.

To avoid the numbers of a referenced section, table, figure, etc. to appear on a newline, an unbreakable space can be added ( ).

Section 1 presents… Section 2 shows… Section 3 concludes.

As can be seen in Figure 2.1, …

Figure 2.1: Description for sensory impaired users.

Figure 2.2 shows sepal lenght as a function of sepal width, from the iris dataset:

Width of sepals as a function of length.

Figure 2.2: Width of sepals as a function of length.

Sed feugiat vehicula urna, id gravida nisi semper quis. Nam leo augue, dictum sed rutrum porta, ornare vel est. Mauris egestas arcu dui, quis fringilla arcu auctor ut. Aliquam sollicitudin facilisis ultricies. Phasellus tristique metus leo, et faucibus odio malesuada vitae. Vestibulum tincidunt sodales metus, eget fermentum sem fermentum non. Morbi ultrices leo urna, nec commodo sapien tincidunt eget.

As reported in Table 2.1

Table 2.1: Caption of the table.
Left-aligned column Centred column Right-aligned column
cell 1, row 1 cell 2, row 1 cell 3, row 1
cell 1, row 2 cell 2, row 2 cell 3, row 2
cell 1, row 3 cell 2, row 3 cell 3, row 3

Tables created with R can also be shown in the document. Here is an example with Table 2.2 :

Table 2.2: The first rows of the famous iris dataset.
Sepal.Length Sepal.Width Petal.Length Petal.Width Species
5.1 3.5 1.4 0.2 setosa
4.9 3.0 1.4 0.2 setosa
4.7 3.2 1.3 0.2 setosa
4.6 3.1 1.5 0.2 setosa
5.0 3.6 1.4 0.2 setosa
5.4 3.9 1.7 0.4 setosa
4.6 3.4 1.4 0.3 setosa
5.0 3.4 1.5 0.2 setosa
4.4 2.9 1.4 0.2 setosa
4.9 3.1 1.5 0.1 setosa

2.1 Subsection Title

Donec aliquet semper arcu eget malesuada. Proin lobortis mauris scelerisque, auctor tortor nec, mollis diam. Vivamus diam nisl, faucibus ut tincidunt vitae, vestibulum ac elit. Pellentesque ullamcorper ornare libero non lobortis. Aliquam neque justo, scelerisque nec sagittis ac, efficitur et eros. Sed eu orci eget est rhoncus eleifend. Nam eget orci volutpat, eleifend nisi vel, blandit lectus. Aenean ac ligula quis nisl ultrices scelerisque. Nullam euismod mi ut elementum commodo. Ut orci nibh, tempus sit amet odio id, egestas mattis velit. Quisque finibus magna a leo congue blandit. Curabitur lacus tellus, pharetra a metus nec, lobortis auctor nibh. Integer consectetur tortor non ullamcorper interdum. Ut non purus libero.

Some LaTeX formula can be written:

\[K(x_i, x_{i^\prime}) = \exp\left( -\gamma \sum_{j=1}^{p} \left(x_{ij} - x_{i^\prime j}\right)^2\right),\] The equations can be numbered, both in the HTML and the PDF outputs:

\[\begin{align} \phi_i = \sum_{S \subseteq F\setminus\{i\}} \frac{|S|!(|F|-|S|-1)!}{|F|!} \left(f_{S\cup \{i\}}(x_{S\cup \{i\}}) - f_S(x_S)\right),\label{eq:shap} \end{align}\]

Another numbered equation:

\[\begin{align} \beta_0+ \beta_1 \mathbf{x}_1 + \beta_2 \mathbf{x}_2 = 0 \label{eq:svmHyperplaneDroite} \end{align}\]

These equations can then be referred to. For example, Equation \(\eqref{eq:shap}\) or Equation \(\eqref{eq:svmHyperplaneDroite}\).

3 Second Section

Vivamus faucibus eros eget dapibus tempus. Vivamus quis tincidunt orci, id iaculis felis. Pellentesque sed accumsan ex. Nullam in lacus tempor, tincidunt quam ut, tincidunt magna. Ut aliquam tincidunt ante at pretium. Praesent venenatis erat at congue viverra. Mauris posuere ultricies ipsum.

Some coloured frames can be included. The colors are defined in assets/style.css for the HTML output and in assets/style_rapport_amu.tex for the PDF output.

Multiple colors are available.

Green frame.

Blue frame.

Red frame.

Orange frame.

Aliquam ultrices volutpat dignissim. Sed aliquet consequat neque in tempus. Quisque egestas felis at elit egestas posuere. Praesent vitae massa vitae dui sagittis semper. Maecenas vehicula, erat ac pretium aliquet, nisi elit mollis ipsum, eget pellentesque sem libero nec massa. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Praesent eu dictum lorem.

Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla euismod at dui at faucibus. Donec ornare ultrices leo, at scelerisque dui consequat id. Maecenas vehicula enim a tellus vehicula sodales ut eu sem. Integer facilisis tempor cursus. Ut vel semper magna. Nam aliquam massa mi, eget maximus odio tincidunt eget. Sed consectetur metus eget imperdiet congue.

Sed rutrum velit non massa tristique convallis porttitor quis sem. Cras orci quam, consequat vel nulla id, bibendum dignissim turpis. Nam dictum augue vel mauris sodales, in luctus libero ornare. Donec lectus urna, gravida sit amet neque nec, tempor feugiat leo. Duis et arcu non est sagittis maximus. Phasellus nunc metus, eleifend eu consequat ultricies, dapibus ut lectus. Nam sodales lacus in neque condimentum hendrerit. Aliquam nec vehicula ipsum. Integer ex arcu, fermentum at iaculis non, consectetur ut leo. Morbi maximus lorem non molestie bibendum. Nunc quis ornare justo. Duis venenatis mi orci, posuere porta odio vestibulum nec. Phasellus pretium vulputate egestas.

4 Conclusion

Sed et dignissim dui, non pulvinar nisi. Quisque luctus tincidunt tristique. Vestibulum varius faucibus magna quis laoreet. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Praesent ut lorem sed dolor ultrices iaculis. Nunc porta non neque quis eleifend. Donec neque risus, accumsan et interdum sed, interdum vitae massa. Aliquam scelerisque congue diam ut tincidunt. Nunc pulvinar turpis vel lacus vehicula, ut auctor sem vestibulum. Curabitur in felis aliquet, pharetra mi in, dapibus massa. Maecenas non sem sed mi dapibus pulvinar. Fusce et libero sit amet mi vulputate rhoncus.

Sed efficitur ornare mi quis aliquam. Duis molestie elit et tempus tempor. Praesent sit amet nibh sapien. Curabitur facilisis, ipsum nec posuere pulvinar, nulla lorem pellentesque felis, vel egestas nulla lorem vel nunc. Praesent imperdiet et orci non fringilla. Proin malesuada felis at volutpat auctor. Donec in imperdiet lorem. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam dignissim in ex a fringilla. Donec ex ligula, interdum eget eros non, vehicula hendrerit nulla. Aliquam venenatis tellus neque, sed viverra dolor porta id. Maecenas volutpat tincidunt aliquet. Aliquam porttitor, felis nec tincidunt ullamcorper, urna mauris gravida eros, in luctus nibh urna eget lorem. Ut congue commodo auctor. Ut lectus dolor, porttitor vel pulvinar eget, suscipit vel mi. Proin suscipit sapien faucibus rutrum interdum.

Curabitur vulputate sapien quis condimentum tristique. Integer quis venenatis lectus. Nam vel dapibus enim. In dictum erat at ligula luctus, sit amet sodales nisi dignissim. Mauris aliquam arcu vitae ipsum faucibus, sit amet vestibulum tellus fermentum. Sed dapibus dapibus eros id porttitor. Nunc non eros eu mauris sagittis consequat sit amet a eros.

References

Athey, Susan, and Guido W. Imbens. 2017. “The State of Applied Econometrics: Causality and Policy Evaluation.” Journal of Economic Perspectives 31 (2): 3–32. https://doi.org/10.1257/jep.31.2.3.
Xie, Yihui, Joseph J Allaire, and Garrett Grolemund. 2018. R Markdown: The Definitive Guide. Chapman; Hall/CRC.