首先,我会告诉你我正在试图做大局面,以防万一我错了。我有一个嵌套的表格,我想使用knitr将它作为LaTeX表格放入RStudio中。我很好,直到我尝试添加标题。我尝试了tables
vignette (LINK)中第9页的示例。Hmisc ::乳胶不打印标题w /表格对象
它没有标题,但当我添加标题它没有。它也适用于非表格对象。有趣的是,latex.default
的作品,但在RStudio/knitr的编译PDF和我所读的是由latex
无论如何称为错误;再加上表格不适合了。我尝试了latexTabular
,但是也没有适当地舍入。
library(Hmisc); library(tables)
latex(head(mtcars), file="", caption="de") #works
x <- tabular((Species + 1) ~ (n=1) + Format(digits=2)*
(Sepal.Length + Sepal.Width)*(mean + sd), data=iris)
latex(x, file="", caption="de") #no caption :(
理想我希望能够在输出\caption{de}
但无法弄清楚我要去哪里错了。
在情况下,它是有帮助这里的输入和输出:从平板状
> latex(x, file="", caption="de", label="tab1")
\begin{tabular}{lccccc}
\hline
& & \multicolumn{2}{c}{Sepal.Length} & \multicolumn{2}{c}{Sepal.Width} \\
Species & n & mean & sd & mean & sd \\
\hline
setosa & $\phantom{0}50$ & $5.01$ & $0.35$ & $3.43$ & $0.38$ \\
versicolor & $\phantom{0}50$ & $5.94$ & $0.52$ & $2.77$ & $0.31$ \\
virginica & $\phantom{0}50$ & $6.59$ & $0.64$ & $2.97$ & $0.32$ \\
All & $150$ & $5.84$ & $0.83$ & $3.06$ & $0.44$ \\
\hline
\end{tabular}
'tabular()'从哪里来? –
@Josh我的道歉表格来自表格包。 –
@Brandon我不认为xtable可以处理嵌套表,但我很想错,因为xtable非常适合使用。通常情况下,我很清楚他的表格,但我试图走向完全可重复的研究,并将所有内容作为一个文件与knitr一起运行。 –