My Rmarkdown document looks something like this.
---
yaml metadata
---
```{r}
x <- 10
```
Some code explanation
```{r}
y <- 10
```
Some more code explanation
```{r}
z <- x + y
```
The final output
```
# 10
```
Since I am following the concepts of literate programming, how to print these multiple code chunks stitched together, so I can get the whole working code printed out as follows without the code explanation. Also, can I select specific code chunks and not all and print them out?
x <- 10
y <- 10
z <- x + y