Skip to content
Discussion options

You must be logged in to vote

Well, here we go:

---
title: "Some Page"
format: 
  html: default
  pdf: default
  docx: default
---


```{r}
#| warning: false
#| message: false
#| echo: false

library(tidyverse)
library(flextable)
knitr::opts_knit$set(output.dir = "./")
data = data.frame(
  year = c(2021, 2022, 2023),
  budget = c("$100", "$200", "$300"),
  profit = c("$100", "$200", "$300")
)
```


```{r}
#| warning: false
#| message: false
#| echo: false
#| output: asis

for (y in data$year)
{
  cat(str_glue("## Year: {y}\n"))
  ft <- data |>
    filter(year == y) |>
    flextable()
  
  flextable_to_rmd(ft)
  cat("\n\n")
}
```

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

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

Answer selected by abalter
@abalter
Comment options

@Steinthal
Comment options

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 knitr computations
3 participants