[R] An R clause to bind dataframes under certain contions

John Kane jrkrideau at yahoo.ca
Sat Jan 26 23:14:00 CET 2008


Have a look at rbind.fill() in the reshape library. 
This will return a data.frame not a matrix but you can
always convert it to a matrix.


--- zhihuali <lzhtom at hotmail.com> wrote:

> 
> Hi netters,
> Suppose I have two data frames X and Y. X has three
> colnames A, B and C. Y has three colnames A,B and D.
> 
> I want to combine them into one matrix, joining the
> rows having the same A and B values (X$A==Y$A and
> X$B = Y$B). So the resulting dataframe has four
> variables/columns: A,B,C and D.
> 
> I was wondering what's the best way to do it in R. 
> Could anyone give me some advice?
> 
> Thanks!
> 
> Zhihua Li
> 
> 
>
_________________________________________________________________
> ÊÖ»úÒ²ÄÜÉÏ MSN ÁÄÌìÁË£¬¿ìÀ´ÊÔÊÔ°É£¡
> 
> 	[[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.
>



More information about the R-help mailing list