Last active
February 15, 2023 20:29
-
-
Save baptiste/cdd86df690597d98947ce811e45b98fb to your computer and use it in GitHub Desktop.
code externalisation in quarto
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "file 1" | |
format: html | |
--- | |
## Code Externalisation | |
Write R code in external R scripts, and use `read_chunk()` to read them into the current document. | |
```{r cache=FALSE} | |
knitr::read_chunk('script.R') | |
``` | |
The following two chunks are from the external R script `script.R`: | |
```{r test-a} | |
``` | |
```{r test-b} | |
``` | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "file 2" | |
format: html | |
--- | |
## Code Externalisation, second file | |
Write R code in external R scripts, and use `read_chunk()` to read them into the current document. | |
```{r cache=FALSE} | |
knitr::read_chunk('script.R') | |
``` | |
The following two chunks are from the external R script `script.R`: | |
```{r test-a} | |
``` | |
```{r test-b} | |
``` | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ---- test-a ---- | |
1 + 1 | |
x = rnorm(10) | |
# ---- test-b ---- | |
mean(x) | |
sd(x) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment