When using loops in an R Markdown for HTML document, the htmlDependency object for flextable must also be added at least once.

flextable_html_dependency()

Examples

if(require("htmltools"))
  div(flextable_html_dependency())
#> Loading required package: htmltools
#> <div></div>