[R] merge table rows (\multirow)

Dieter Menne
Mon, 12 Jan 2009 16:32:06 -0000

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.