Skip to content

Multiple gt tables in a for() renders none of the table #10563

Answered by mcanouil
andrie asked this question in Q&A
Discussion options

You must be logged in to vote

In the order of the document:

For "complex R object" inside for loops in knitr you usually need knitr::knit_child()/knitr::knit_expand().

One answer/solution:

Input Output
---
title: "Multi-page gt table"
format: typst
---

```{r}
#| label: setup
#| include: false
library(dplyr)
library(gt)
```

```{r}
#| echo: false
#| output: asis
cyls <- unique(mtcars$cyl)
for (cyl in cyls) {
  tab <- gt(filter(mtcars, cyl == !!cyl))
  cat(sep = "\n", knitr::…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@andrie
Comment options

@cscheid
Comment options

@andrie
Comment options

Answer selected by andrie
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
tables Issues with Tables including the gt integration computations typst
3 participants