...{r} what does it mean?

I was wondering what the ‘…{r}’ together with the ‘message=false, warning=false’ actually entails in the following code:

``{r message=FALSE, warning=FALSE}

load libraries

library(readr)

library(dplyr)


```{r}

What functions are they executing?

In the R Markdown document, this just specifies that the code contained within should be run as a r chunk. The way R Markdown works is anything you write normally is part of the document, and anything within an R chunk is executed as R code.

# This is a Heading 1 in Markdown
## This is a Heading 2 in Markdown
```{r}
var <- "This is an R code chunk"
```

As such, This is simply declaring that R code is contained within the backticks.

These code blocks can have many options however. I believe at last count there are around 50, however only a few are generally used. In this case, message = FALSE indicates that code messages should not be displayed in the document. Whereas warning = FALSE indicates that any warnings which may occur in the running of the code should not be displayed in the document. You can have many other option types, such as echo = TRUE/FALSE which would say if the code running should be included, or include = TRUE/FALSE which would say if the code should be included in the document at all (this one is generally used when loading packages and datasets in the background).

Hopefully this makes sense. I do have an issue with the Codecademy R course in that it teaches you within a Markdown document, when this isn’t actually the normal way to use R, it’s like an extra bonus used to create automated reports. However I understand the limitations in trying to port R to the web and so understand the reasoning.

TL;DR: it indicates to the script that a chunk of R code is to be executed, and options are placed on this to determine what parts of the R code are to be included in the resulting document.

3 Likes