Re: [R] formatting tables with long column names via package:xtable within Sweave

From: Jonathan Baron <>
Date: Thu 15 Jul 2004 - 21:08:03 EST

On 07/15/04 11:07, wrote:
>I use the excellent Sweave tools for writing documents
>but was wondering how to neatly print a data.frame
>with long column headings.
>I cant manage to do this via package:xtable.

I think a problem with xtable is this:

> xtable(d1,align=c("|l|","c","c","c","c|"))
Error in "align<-.xtable"(`*tmp*`, value = switch(1 + is.null(align), :

		 "align" must be containing elements of

So the align attribute won't accept p(1cm) either, for example, but this might not be the best solution anyway. It seems just as easy to modify your table after xtable makes it than to modify xtable to allow such things, since xtable would not save you any typing time. You could stick in your long headers using \multicolumn{1}{p(2cm)}{blah blah blah}, or \parbox{}, or just use two rows. (I haven't tested any of this.)


Jonathan Baron, Professor of Psychology, University of Pennsylvania
Home page:  
R search page:

______________________________________________ mailing list
PLEASE do read the posting guide!
Received on Thu Jul 15 21:18:17 2004

This archive was generated by hypermail 2.1.8 : Wed 03 Nov 2004 - 22:54:59 EST