Search code examples
rquartogt

How to print multiple gt tables in a quarto chunk?


I have a list of gt tables I'd like to display. I seem to recall in RMarkdown, I could use a walk(tabs, print) statement inside a chunk with with results = "asis" chunk option for this to work.

I can't figure out how to do this in Quarto? Any advice?

Here is what I tried, but it fails to render.

---
title: "Untitled"
format: html
editor: source
---

```{r}
library(tidyverse)
library(gt)
df <- mtcars[1:5, 1:2] 
tab <- gt(df)
```

```{r}
#| results: asis
rep(list(tab), 3) %>%
  walk(print)
```

The error in rendering is as follows:

    Error running filter C:/Users/xxxxx/AppData/Local/Programs/Quarto/share/filters/quarto-pre/quarto-pre.lua:
.../Programs/Quarto/share/filters/quarto-pre/quarto-pre.lua:2555: attempt to concatenate a nil value (local 'v')
stack traceback:
    .../Programs/Quarto/share/filters/quarto-pre/quarto-pre.lua:2562: in function <.../Programs/Quarto/share/filters/quarto-pre/quarto-pre.lua:2560>

Solution

  • I updated the quarto CLI software, the quarto package, rmarkdown, and knitr, and the error went away. Appreciate everyone who chimed in.