[R] Questions about xtable and print.xtable

From: Charilaos Skiadas <skiadas_at_hanover.edu>
Date: Tue 23 Jan 2007 - 02:50:42 GMT

I have been using the wonderful xtable package lately, in combination with Sweave, and I have a couple of general questions along with a more particular one.

I'll start with the particular question. I basically have a 1x3 array with column names but no row names. I want to create a latex table with column setting set to "|rrr|". I want the column names to appear, but the row names not to appear. The code I am trying is this:

x <- matrix(c(1:3), c(1,3), dimnames=list(NULL,c(1:3))) tab <- xtable(x, align="|rrrr|")
print.xtable(tab, include.rownames=FALSE) print.xtable(tab)

The problem here is that the xtable call requires an align value that has one extra row setting, I suppose to account for a possible row name. However, the first print.xtable call seems to ignore the align argument set in the xtable call, when include.rownames is included. Any workarounds will be most welcomed.

More generally, I have the following questions: 1) Why are the include.rownames and include.colnames parameters not appearing in the xtable call, but only in the print.xtable call instead? Why do I need to specify n+1 arguments for things like align and digits, when I don't want the row names to be printed? In general, why are the align and digits calls not setable in print.xtable, but only in xtable?
2) I like to enclose my tabular environments in a center environment, instead of a table environment. Unless I've missed it, I don't see how I can do that from within the xtable package. Is this really not possible, and if so why not? The latex.environments setting seems to only be allowed when floating=TRUE, which is exactly what I want to avoid. Any particular reason it is not allowed when floating=FALSE as well?

That's it really, thanks in advance for any responses.


R-help@stat.math.ethz.ch 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. Received on Tue Jan 23 13:59:34 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 23 Jan 2007 - 05:30:34 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.