R code in RMarkdown documents

Berkomunikasi dengan Data di Tidyverse

Timo Grossenbacher

Data Journalist

Berkomunikasi dengan Data di Tidyverse

Adding R chunks


```{r}
x <- 2 + 2
x
```

4

2 plus 2 equals `r 2 + 2`.

2 plus 2 equals 4.

Berkomunikasi dengan Data di Tidyverse

The `knitr` package

1 R for Data Science (http://r4ds.had.co.nz/r-markdown.html)
Berkomunikasi dengan Data di Tidyverse

R chunk options


```{r include=FALSE}
x <- 2 + 2
x
```

```{r}
x
```

4

Berkomunikasi dengan Data di Tidyverse

More R chunk options

Option Effect
include Whether to show the R code chunk and its output.
echo Whether to show the R code chunk.
message Whether to show output messages.
warning Whether to show output warnings.
eval Whether to actually evaluate the R code chunk.

More options on the respective help page of the knitr package.

Berkomunikasi dengan Data di Tidyverse

Let's try this out!

Berkomunikasi dengan Data di Tidyverse

Preparing Video For Download...