[R] xtable and sweave: caption placement problem

Charles Roosen croosen at mango-solutions.com
Fri Nov 18 10:51:21 CET 2011


Dear Renger,

This is occurring because "xtable" divides up the arguments into items related to the "content" of the table and arguments related to the "layout" of the table.

The "caption.placement" is an argument to "print.xtable()" rather than to "xtable()":

  print(xtable(summary(lm(y~x)),
    align="rcccc",
    caption="Summary  statistics  for  the  regression  model", label="tab:summary",
    digits=2),
    caption.placement="top")

If you have any additional questions, feel free to contact me.

Best regards,
Charlie Roosen
xtable maintainer

Charles Roosen, PhD
Technical Director
Mango Solutions AG


-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of renger at vannieuwkoop.ch
Sent: 18 November 2011 09:33
To: r-help at r-project.org
Subject: [R] xtable and sweave: caption placement problem

Dear All

I am running Sweave with xtable and want to put the caption placement  
on top. But this does not work. Any idea what is going wrong?

Here is an example that runs properly with the exception of the  
caption placement in the pdf-file.

\documentclass[11pt,a4paper]{article}
\usepackage{Sweave}
\begin{document}
<<>>=
x  =  runif(100,  1,  10)
y  =  2  +  3  *  x  + rnorm(100)
@

<<echo=FALSE,results=tex>>=
library(xtable)
print(xtable(summary(lm(y~x)),
align="rcccc",
caption="Summary  statistics  for  the  regression  model",  
caption.placement="top", label="tab:summary",
digits=2))

@

\end{document}


Renger


_________________________________________
Renger van Nieuwkoop
Centre for Energy Policy and Economics, ETH Zürichbergstrasse 18 (ZUE) 
CH - 8032 Zürich
+41 44 632 02 63
mailto: renger at vannieuwkoop.ch
blog.modelworks.ch

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
LEGAL NOTICE
This message is intended for the use o...{{dropped:10}}



More information about the R-help mailing list