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: [email protected] [mailto:[email protected]] On
Behalf Of [email protected]
Sent: 18 November 2011 09:33
To: [email protected]
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: [email protected]
blog.modelworks.ch
______________________________________________
[email protected] 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}}
______________________________________________
[email protected] 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.