[R] merge table rows (\multirow)

Felipe Carrillo mazatlanmexico at yahoo.com
Mon Jan 12 20:20:57 CET 2009


Thanks a lot Dieter, I'll play a little bit with it. Also thanks for the hint on how to post a latex reproducible example.



--- On Mon, 1/12/09, Dieter Menne <dieter.menne at menne-biomed.de> wrote:

> From: Dieter Menne <dieter.menne at menne-biomed.de>
> Subject: Re: [R] merge table rows (\multirow)
> To: r-help at r-project.org
> Date: Monday, January 12, 2009, 8:32 AM
> Felipe Carrillo wrote:
> > 
> > I am trying to merge the 'Month' column using
> \multirow. For example for
> > the column 'Week' I want July to be merged
> into one row(weeks 27,28,29,30)
> > and so on for the following weeks.
> > Below, I am creating a PDF using Sweave,
> MikTex,R-2.8.1 and windows XP to
> > show an example.
> > 
> > 
> 
> .. Example removed and partially regenerated below
> 
> Another try; had a bad hour this morning, too many typos. 
> This comes closer to what you want, but not exactly. 
> You might try to manually call format.df which is
> implicitly 
> called in latex, and massage that.
> Again, I do not know if this is easier with xtable.
> 
> If you want to post latex samples, it is not really
> necessary to include it in Sweave. The example
> below works fine for testing.
> 
> Dieter
> 
> 
> library(Hmisc)
> sampDat <- "Month Week Estpassage MedFL
> July 27	   665	         34
> July 28	   2232	       35
> July 29	   9241	       35
> July 30	   28464	       35
> Aug  31	   41049	       35
> Aug 32	   82216	       35
> Aug 33	   230411      35
> Aug 34	   358541      35
> Sept 35	   747839      35
> Sept 36	   459682      36
> Sept 37	   609567      36
> Sept 38	   979475      36
> Sept 39	   837189      36"
> DF <- read.table(textConnection(sampDat), header = TRUE)
> row.names(DF)=DF$Week
> latex(DF[,-2],label="tab:hola",longtable=FALSE,caption='Sample
> table.', rowname="",rgroup=unique(DF$Month),n.rgroup=table(DF$Month))
> 
> -- 
> View this message in context:
> http://www.nabble.com/merge-table-rows-%28%5Cmultirow%29-tp21408818p21417983.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> 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.




More information about the R-help mailing list