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

2008-01-26 Thread John Kane
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 <[EMAIL PROTECTED]> 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,

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

2008-01-26 Thread Henrique Dallazuanna
On 26/01/2008, David Winsemius <[EMAIL PROTECTED]> wrote: > "Henrique Dallazuanna" <[EMAIL PROTECTED]> wrote in > news:[EMAIL PROTECTED]: > > > Try this: > > merge(x, y, all=T) > > That will give 's in the non-matching rows, which may be what the > OP wanted. If, on the otherhand, only the rows wit

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

2008-01-26 Thread David Winsemius
"Henrique Dallazuanna" <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > Try this: > merge(x, y, all=T) That will give 's in the non-matching rows, which may be what the OP wanted. If, on the otherhand, only the rows with matches were desired, the usage might be: A.B <- merge(X, Y, by =

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

2008-01-26 Thread Wensui Liu
Hi, Huali, there is another way to do so library(sqldf) wanted <- sqldf("select * from X inner join Y on X.A = Y.A and X.B = Y.A") 2008/1/26 zhihuali <[EMAIL PROTECTED]>: > > 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.

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

2008-01-26 Thread Henrique Dallazuanna
Try this: merge(x, y, all=T) On 26/01/2008, zhihuali <[EMAIL PROTECTED]> 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 va

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

2008-01-26 Thread zhihuali
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 an