[R] matrix filtering and reordering

Peter Alspach PAlspach at hortresearch.co.nz
Wed Apr 8 00:07:38 CEST 2009


Kia ora Juan

?merge

HTH ....

Peter Alspach 

> -----Original Message-----
> From: r-help-bounces at r-project.org 
> [mailto:r-help-bounces at r-project.org] On Behalf Of Juan Pablo Fededa
> Sent: Wednesday, 8 April 2009 8:55 a.m.
> To: r-help at r-project.org
> Subject: [R] matrix filtering and reordering
> 
> I have two matrixes,
> 
> red:
> 
> a 123
> c 200
> d 400
> e 650
> g 127
> f 100
> 
> and blue:
> 
> a 10
> b 20
> c 30
> d 40
> e 50
> f 60
> g 70
> 
> is there any easy way to get the next matrix:
> 
> a 10 123
> b 20 0
> c 30 200
> d 40 400
> e 50 650
> f 60 100
> g 70 127
> 
> i.e. to add in the third column of blue the [,2] values of 
> red corresponding to the file with same [x,1] value of blue, 
> adding a cero in the case that there is no [x,1] 
> corresponding value in the red matrixes (case for row 2 of blue).
> Thanks in advance,
> 
> 
> juan
> 
> 
> 
> Juan Pablo Fededa
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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.
> 

The contents of this e-mail are confidential and may be subject to legal privilege.
 If you are not the intended recipient you must not use, disseminate, distribute or
 reproduce all or any part of this e-mail or attachments.  If you have received this
 e-mail in error, please notify the sender and delete all material pertaining to this
 e-mail.  Any opinion or views expressed in this e-mail are those of the individual
 sender and may not represent those of The New Zealand Institute for Plant and
 Food Research Limited.




More information about the R-help mailing list