Skip to content

Instantly share code, notes, and snippets.

@andrewheiss
Last active April 29, 2024 02:25
Show Gist options
  • Save andrewheiss/43bbdedc67dc1389811afccf3c3118f5 to your computer and use it in GitHub Desktop.
Save andrewheiss/43bbdedc67dc1389811afccf3c3118f5 to your computer and use it in GitHub Desktop.
---
title: "Testing"
---
```{r}
#| label: fun-generate-chunks
#| include: false
generate_chunk <- function(id) {
paste0(
c(
paste0("```{r fig-", id, ", echo=FALSE}"),
"plot(density(rnorm(1000)))",
"```", ""
),
sep = "\n")
}
```
See @fig-5:
`r knitr::knit(text = generate_chunk(5))`
And see @fig-9:
`r knitr::knit(text = generate_chunk(9))`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment