【发布时间】:2022-01-01 10:20:54
【问题描述】:
我正在尝试打印 HTML 表格列表,但由于某种原因,当我编织文档时,我得到了用于输出的原始 HTML 代码,而不是渲染的表格。示例:
---
title: "html-render-issue"
output: html_document
---
library(tidyverse)
library(gtsummary)
# this table renders correctly:
tbl_summary(iris)
# but this table does not!!
tables <- list(tbl_summary(iris), tbl_summary(cars))
print(tables)
我不明白为什么会这样,我尝试使用 for 循环索引到列表中
for (i in 1:2) {
print(tables[[i]])
}
但这似乎也不起作用!没有做tables[[1]]; tables[[2]] 等(确实有效),有没有办法遍历列表并获得我想要的输出?
【问题讨论】:
标签: html r r-markdown knitr gtsummary