使用pander中的标题在for循环中打印可反应的表

使用pander中的标题在for循环中打印可反应的表,r,reactable,R,Reactable,我想从数据集中的组中创建标题。在每个组中,我希望在该组所属的每个标题下打印一个可反应的表。这就是我所尝试的: --- title: "test" author: "" date: '2020-10-13' output: html_document: theme: flatly toc: true toc_float: collapsed: true --- ```{r setup, include=FALSE}

我想从数据集中的组中创建标题。在每个组中,我希望在该组所属的每个标题下打印一个可反应的表。这就是我所尝试的:

---
title: "test"
author: ""
date: '2020-10-13'
output:
  html_document:
    theme: flatly
    toc: true
    toc_float:
      collapsed: true
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
library(pander)
library(reactable)
library(tidyverse)
library(kableExtra)
library(knitr)

```

```{r results='asis'}

panderOptions('knitr.auto.asis', FALSE)

for(spec in unique(iris$Species)){
  pander::pandoc.header(spec, level = 1)
  
  iris_filt = iris %>% 
    filter(Species == spec)
  
  
  print(iris_filt %>%
    reactable())
  
  # Does work
  #print(iris_filt %>% 
  #        kable())
  
}

```
这只给我标题,但不打印表格。这适用于使用print+kable的普通表格

关于如何让它与reactable一起工作,有什么想法吗