Skip to content
Discussion options

You must be logged in to vote

I believe this answer regarding gt tables created dynamically can help understand how you could do that with knitr. This is linking to resources already working in R Markdown ecosystem.

#2370 (comment)

Without your example, I would do that

---
title: "Untitled"
format: pptx
---

```{r, include=FALSE}
library(tidyverse)
cyls <- unique(mtcars$cyl)

descs <- c(
    "These cars are good",
    "These cars are fun",
    "I have no opinion on these cars")

```

```{r}
#| output: asis
src <- purrr::map2_chr(cyls, descs, \(cyls, desc) {
  knitr::knit_expand(text = c(
    "## {{ cyls }} Cyls",
    "",
    "{{ desc }}",
    "",
    "",
    "```{r}",
    "#| echo: true",
    "mtcars  |>",
    "  filt…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@baslat
Comment options

@baslat
Comment options

@baslat
Comment options

@cderv
Comment options

Answer selected by baslat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants