Last active
April 29, 2024 04:25
-
-
Save andrewheiss/222b426ad8e2b177b9a4a0c7e98fe228 to your computer and use it in GitHub Desktop.
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
--- | |
title: "Testing with lots of plots" | |
--- | |
```{r} | |
#| label: fun-generate-chunks | |
#| include: false | |
generate_chunk <- function(id) { | |
paste0( | |
c( | |
paste0("```{r fig-", id, ", echo=FALSE}"), | |
paste0("plot(density(rnorm(1000)), main = '", id, "')"), | |
"```", "", "" | |
), | |
sep = "\n") | |
} | |
n_figs <- 15 | |
out <- NULL | |
for (i in 1:n_figs) { | |
out <- c(out, generate_chunk(i)) | |
} | |
``` | |
See @fig-1 through `r paste0("@fig-", n_figs)` and all the other figs here: | |
`r paste(knitr::knit(text = out), collapse = "\n")` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment