Re: [R] merge

From: Mike Meredith <mmeredith_at_wcs.org>
Date: Thu, 21 Jun 2007 23:47:58 -0700 (PDT)

Looking at the data, maybe what you need is an array:

array(c(A, B), c(5,6,2), dimnames=list(rownames(A),

    colnames(A), c("obs","pred")))

This allows you to keep the names and 'supernames'.

This will work if A and B are matrices, not data frames, so you may have to use 'as.matrix' first.

HTH, Mike.

elyakhlifi mustapha wrote:
>
> Hello,
> ok I know how to do to merge matrix or data.frame by "row.names" but my
> true objectif is to merge for example this data.frame:
>

>> A

> obs
> Rép1 Rép2 Rép3 Rép4 Rép5 Rép6
> Var1 145 145 150 145 140 145
> Var2 150 150 160 155 155 150
> Var3 155 155 160 150 150 140
> Var4 150 145 145 145 140 145
> Var5 135 130 145 135 135 130
>
> and
>
>> B

> pred
> Rép1 Rép2 Rép3 Rép4 Rép5 Rép6
> Var1 146.00 144.00 151.00 145.00 143.00 141.00
> Var2 154.33 152.33 159.33 153.33 151.33 149.33
> Var3 152.67 150.67 157.67 151.67 149.67 147.67
> Var4 146.00 144.00 151.00 145.00 143.00 141.00
> Var5 136.00 134.00 141.00 135.00 133.00 131.00
>
> and the main difficulty is to keep the names and the supernames.
>
-- 
View this message in context: http://www.nabble.com/merge-tf3953336.html#a11247082
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help_at_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 Fri 22 Jun 2007 - 06:52:59 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 22 Jun 2007 - 07:32:16 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.