Sunday, 15 February 2015

r - xtable adding a title on top and a caption under the table -



r - xtable adding a title on top and a caption under the table -

i want set caption title on xtable in rnw document. here's code. unfortunately, i'm not able add together caption under table. i've tried \caption{} function, won't print pdf.

i've seen r: xtable caption (or comment), it's not working table created lm() function in r. have clue?

<<yoman,echo=false,results=tex>>= library(xtable) pop5lm <- lm(mpg ~ wt, data=mtcars) #my linear model print(xtable(pop5lm, caption = c("estimates of linear model father muro cb"), label = "tab:one", digits = c(0,2, 2, 2,3)), table.placement = "tbp", caption.placement = "top") @

caveat: not frequent user of either xtable nor latex.

i couldn't see quick alternative in xtable add together text bottom of table (that doesn't mean there isn't one) have used thought here , link in question. rather rough prepare big drawback need specify width of text add together (equal width of table) - if create long stretches final column (to see alter 8.5 10).

\documentclass{article} \usepackage{array} \newcolumntype{l}[1]{>{\raggedright\arraybackslash}m{#1}} \begin{document} \sweaveopts{concordance=true} <<yoman,echo=false,results=tex>>= library(xtable) mod <- lm(mpg ~ wt, data=mtcars) #my linear model print(xtable(mod, caption = "estimates of linear model father muro cb ", #label = "tab:one", digits = c(0,2, 2, 2,3)), table.placement = "h!", caption.placement = "top", add.to.row = list(list(2), "\\hline \\multicolumn{5}{l{8.5cm}}{\\textbf{note: } description, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah} \\\\")) @ \end{document}

i assume there many alternatives in latex accomplish might started.

r latex sweave caption xtable

No comments:

Post a Comment