-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
502fcfb
commit cc3d2e1
Showing
3 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
--- | ||
title: "Parameterized report" | ||
description: "Report with parameterized text/code from external yaml" | ||
author: "Roy Francis" | ||
date: 08-Oct-2023 | ||
format: | ||
html: | ||
title-block-banner: true | ||
theme: pulse | ||
highlight: kate | ||
code-tools: true | ||
|
||
params: | ||
dfr: virginica | ||
--- | ||
|
||
In this parameterized report, code parameters are specified in an external yaml file named `params.yml`. | ||
|
||
```{bash} | ||
#| eval: false | ||
#| filename: params.yml | ||
dfr: "setosa" | ||
``` | ||
|
||
Text metadata is specified in an external yaml file named `metadata.yml`. | ||
|
||
```{bash} | ||
#| eval: false | ||
#| filename: metadata.yml | ||
section: "Section A" | ||
block: "This is the first part of the **analysis**. More information. bla bla." | ||
``` | ||
|
||
`index.qmd` is this file. See code-tools icons at the top of this document to see the code. | ||
|
||
The document is rendered as such | ||
|
||
`quarto render index.qmd --execute-params params.yml --metadata-file metadata.yml` | ||
|
||
## {{< meta section >}} | ||
|
||
{{< meta block >}} | ||
|
||
|
||
The `r params$dfr` species is subsetted from the data. | ||
|
||
```{r} | ||
#| filename: R | ||
head(subset(iris, iris$Species == params$dfr)) | ||
``` | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
section: "Section A" | ||
block: "This is the first part of the analysis." |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dfr: "setosa" | ||
|