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

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

On 07/15/04 11:07, john.gavin@ubs.com wrote:
>Hi,
>
>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
		 {"r","l","c"}

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.)

Jon

-- 
Jonathan Baron, Professor of Psychology, University of Pennsylvania
Home page:            http://www.sas.upenn.edu/~baron
R search page:        http://finzi.psych.upenn.edu/

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
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