【发布时间】:2015-10-21 16:10:49
【问题描述】:
不久前我向question 询问了如何在 RMarkdown 文档中包装长表格单元格内容。一个不错的答案指向pander() 包。
我又遇到了类似的问题,只是我在使用Rnw 文件,我的理解是pander() 不适用于LaTeX。所以我又回来尝试弄清楚如何在kable() 中换行。
\documentclass{article}
\begin{document}
This is my test
<<test, echo=FALSE>>=
library(knitr)
test <- data.frame(v1=c("This is a long string. This is a long string. This is a long string. This is a long string. This is a long string.",
"This is a another long string. This is a another long string. This is a another long string. This is a another long string. This is a another long string."),
v2=c(1, 2))
kable(test)
@
\end{document}
【问题讨论】:
-
嗨,@eric-green 看起来这个问题真的很困扰你。大声笑我看到你的question about it earlier this year 为什么不在
knitr的github 页面上提交问题? -
它不会让我彻夜难眠,但正如我在问题中指出的那样,我之前确实以不同的形式遇到过它。我想过提交问题,但我不确定这是kable需要解决的问题。正如我接受的答案所指出的那样,xtable 可能会填补这个空白。
-
我今天确实遇到了类似的情况,我找到了你的帖子。
xtable绝对不是我最喜欢的软件包,我也很想看到kable将来有这个功能。 :) -
我已经开始使用 xtable,但我也喜欢 kable 的简单性。我想同时想要大量的定制和简单是很困难的
-
上面链接的问题有一个使用
kable()的答案。