R Markdown
- R Markdown file used in this lesson
- data set mentioned in this lesson
- second data set mentioned in this lesson
What is R Markdown?
R Markdown files are .Rmd files that allow to create HTML or PDF reports with text, R code and the results that are generated by running the R code.
How to create R Markdown files?
You can create them via File in the top menu, like you do when you create a new script but instead of a script you ask to create a R Markdown file. You need the knitr package for this and you need to put the .Rmd file in the same folder as your input files.
Syntax of R Markdown
Check this website for an overview of the R markdown syntax.
Running code chunks in R Markdown
You create “chunks” with R code via:
```{r}
R code
```
When you run the code via the Run buttons in the script editor, the results of the code is always shown in the R Markdown file and if the result is not a plot it is also shown in the console.