R Markdown

R Markdown is a convenient way to write R code, and to create reports of various kind.

  • The compiler assumes called files are in the same directory

When writing long reports, it is usually easier to split the main file in several smaller files, as you may do with $ \LaTeX $.

https://stackoverflow.com/questions/25824795/how-to-combine-two-rmarkdown-rmd-files-into-a-single-output

R Markdown can evaluate inline code too, in two different ways.

First, once evaluated the code can be outputted as text:

`r nrow(df)`

Second, the code can also outputted as “code”:

```r nrow(df)```

In the preamble, it's possible to declare the date of the document. But in a fast-pacing environment, one may want to have a similar functionality as \today in $ \LaTeX$ (that prints the today's date).

To emulate such a feature, use this:

date: "`r format(Sys.time(), '%d %B, %Y')`"

The specific formatting of the date can be adjusted in the second part of format() (see https://www.statmethods.net/input/dates.html).


1)
i.e. the code runs and displays the output/result.
Enter your comment. Wiki syntax is allowed:
If you can't read the letters on the image, download this .wav file to get them read to you.
 
  • Last modified: 3 weeks ago
  • by Olivier Simard-Casanova