使用Knitr的Markdown中具有多列表的HTML [英] HTML with multicolumn table in Markdown using knitr
问题描述
我已经使用了knitr和LaTeX,但我正在考虑更改为Markdown,因为它似乎与Word更加兼容(htlatex和Pandoc的工作原理,但感觉很不舒服).我当前的问题是在Hmisc包中找到latex()的替代方法.我发现的唯一选择是xtable,但它似乎并没有创建多列.
I've used knitr and LaTeX but I'm thinking of changing to Markdown as this seems more compatible with Word (htlatex and Pandoc work but it's far from comfortable). My current problem is finding an alternative to latex() in the Hmisc package. The only alternative I've found is xtable, but it doesn't seem to create multicolumns.
这是一个例子:
mx <- matrix(1:6, ncol=3)
rownames(mx) <- LETTERS[1:NROW(mx)]
colnames(mx) <- sprintf("Col %s", LETTERS[1:NCOL(mx)])
latex(mx, n.rgroup=c(2), rgroup=c("Nice!"),
n.cgroup=c(2,1), cgroup=c("First", "Second"),
file="",
ctable=TRUE)
生成此表:
推荐答案
好,所以我自己写的...
Ok, so I wrote it myself...
该软件包的版本为1.0,称为 htmlTable ,可从CRAN和我的博客 gforge.se中获得. /packages .希望对你有帮助.我创建了一些小插图来帮助您解决所有问题.
The package is as of version 1.0 called htmlTable and is available both from CRAN and and my blog, gforge.se/packages. I hope you find it useful. I've created a few vignettes to help with all the options.
这篇关于使用Knitr的Markdown中具有多列表的HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!