Why not auto-generated reports when we have self-driving cars?

Basic building blocks of R Markdown





Rmarkdown is a file format for making dynamic documents with R. The use of Rmarkdown for generating reports that are e.g. automatically updated at particular intervals of time (e.g. every hour/day) are becoming very popular. An important aspect of such reports is that they are fully reproducible. In addition, all the code for data analysis and visualizations are combined within a single text file.

Bildet kan inneholde: rektangel, gjøre, skjermdump, parallell, teknologi.


Rmarkdown is a plain text file with the .Rmd extension which contains three main components: YAML header (surrounded by ), code chunks (surrounded by Bildet kan inneholde: gjøre, elektrisk blå, mønster, sirkel.) and text. General structure of the output file (such as format, title, date and author) is defined in the YAML section. Code chunks are able to execute codes in many different languages including, but not limited to, R, Python, SQL and Bash. The text section should be written in markdown which is an easy-to-write formatting syntax.  

How does Rmarkdown work under the hood?

Bildet kan inneholde: rektangel, gjøre, parallell, elektrisk blå, sirkel.

When a Rmarkdown file is rendered (i.e. being processed to visualize the results), the knitr package executes the code chunks and generates a markdown document containing the code and its output. The finished format of the document is then created by pandoc that processes the markdown file. It is worth mentioning that creating a PDF document from markdown file requires a LaTeX distribution installed e.g. MiKTeX, TinyTeX or TeX Live. This step might be challenging if you have a proxy setting that makes it difficult to install packages e.g. what you will encounter when analyzing sensitive research data in a secure platform such as TSD (services for sensitive data). The good news is that once you are done with the set-up steps, all the above-mentioned processes will happen with a simple click of a button and you will have an attractive final report that can be regenerated automatically at regular intervals or on-the-fly!

Motivate yourself right now by downloading an example Rmarkdown file and the corresponding generated PDF report (use R to open rmarkdown.rmd file, or you can see the content of the RMarkdown file as PDF here). Just get started and let the motivation catch up with you! 

We in the TASK group have been using R Markdown for auto-generating reports in different projects. Please contact us if you have any questions or you need help with report automation.

How to correctly pronounce LaTeX and YAML?

Leslie Lamport, the American computer scientist and the initial developer of the document preparation system LaTeX, wrote in its first manual: “One of the hardest things about LaTeX is deciding how to pronounce it. This is also one of the few things I’m not going to tell you about LaTeX, since pronunciation is best determined by usage, not fiat. TeX is usually pronounced teck, making lah-teck, and lay-teck the logical choices; but language is not always logical, so lay-tecks is also possible.”[1] 

While Lamport does not favor or discourage any pronunciation for LaTeX, Donald Ervin Knuth who is the creator of the TeX system (that LaTeX is built on) promotes a pronunciation of /ˈtɛx/ (tekh). He wrote in the first chapter of his TeXbook: “English words like ‘technology’ stem from a Greek root beginning with the letters τεχ...; and this same Greek word means art as well as technology. Hence the name TeX, which is an uppercase form of τεχ. Insiders pronounce the χ of TeX as a Greek chi, not as an ‘x’, so that TeX rhymes with the word blecchhh. It’s the ‘ch’ sound in Scottish words like loch or German words like ach; it’s a Spanish ‘j’ and a Russian ‘kh’. When you say it correctly to your computer, the terminal may become slightly moist.”[2]

YAML (/ˈjæməl/, rhymes with camel) which is a human readable and computationally powerful data language was initially meant to stand for Yet Another Markup Language. However, it was later repurposed as YAML Ain't Markup Language in order to distinguish it as data-oriented rather than document markup.

[1] Lamport, Leslie (1986). LaTeX: A Document Preparation System. Addison-Wesley. ISBN 978-0-201-15790-1. Retrieved 2019-06-20.

[2] Computers & Typesetting. Vol. A, The TeXbook. Reading, MA: Addison-Wesley. ISBN 978-0-201-13447-6


Av Sahar Hassani
Publisert 14. mars 2022 16:29 - Sist endret 14. mars 2022 16:29
sju mennesker

En blogg for deg som er interessert i IT-verktøy og datahåndtering, samt informasjon om, og erfaringer fra, forskningsprosjekter hvor bruk av IT inngår som en sentral del, enten det dreier seg om kvalitative eller kvantitative metoder/forskningsspørsmål.