First I will tell you that I am trying to make a big picture if I am wrong. I have a nested table that I would like to put as a LaTeX table in RStudio using knitr. I'm fine until I try to add a signature. I tried the example on page 9 in tables vignette (LINK) .
It works without a title, but when I add a signature, it is not. It also works with non-table object. The funny thing is that latex.default works, but causes an error in the RStudio / knitr Compile PDF, and from what I read, latex is called anyway; plus the table is no longer rounded. I tried latexTabular , but this is not rounded either.
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 :(
Ideally, I would like to have \caption{de} in the output, but I can't figure out where I am going wrong.
If useful, here is the entry and exit:
> 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}
source share