File: loop_with_flextable.Rmd

package info (click to toggle)
r-cran-flextable 0.9.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,320 kB
  • sloc: javascript: 28; sh: 15; makefile: 2
file content (33 lines) | stat: -rw-r--r-- 576 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
---
title: "R Markdown loop with flextable for HTML"
output: html_document
---

```{r setup, include=FALSE}
library(flextable)
library(htmltools)
library(knitr)

opts_chunk$set(echo = TRUE)

ft_list <- list()

ft1 <- qflextable( head( airquality ))
ft1 <- set_caption(ft1,"airquality table")
ft_list[[1]] <- ft1

ft2 <- qflextable( tail( mtcars ))
ft2 <- set_caption(ft2,"mtcars table")
ft_list[[2]] <- ft2
```

```{r echo = FALSE}
div(flextable_html_dependency())
```

```{r results='asis', echo = FALSE}
for(i in seq_along(ft_list)){
  flextable_to_rmd(ft_list[[i]])
}
```