我一直在使用该xtable包从R矩阵中创建HTML表.当我kable在循环中使用该函数时,它没有输出任何内容.所以我盯着使用这个print功能.问题是,当我使用print函数时,我会在HTML表格中打印出很多"##".有没有办法打印我的kable但在循环中避免每行"##"?
library("xtable", lib.loc="~/R/win-library/3.1")
for(i in 1:3) {
#Must use print because of the loop, but get ## per line
print(kable(head(cars), "html", table.attr='class="flat-table"'))
}
#No neded to use print, no ## printed per line
kable(head(cars), "html", table.attr='class="flat-table"')
Run Code Online (Sandbox Code Playgroud)