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(htmlscroll = TRUE)
add a scroll if table is too big to fit into its HTML container, default to TRUE.
if(require("htmltools"))
div(flextable_html_dependency())
#> Loading required package: htmltools
#> <div></div>