Re: [R] merge data frames with same column names of differe nt lengths and missing values

2009-03-08 Thread Dieter Menne
Steven Lubitz slubitz1 at yahoo.com writes: Thank you - this is very helpful. However I realized that with my real data sets (not the example I have here), I also have different numbers of columns in each data frame. rbind doesn't seem to like this. Here's a modified example: x -

Re: [R] merge data frames with same column names of differe nt lengths and missing values

2009-03-07 Thread Dieter Menne
Steven Lubitz slubitz1 at yahoo.com writes: x - data.frame(item1=c(NA,NA,3,4,5), item2=c(1,NA,NA,4,5), id=1:5) y - data.frame(item1=c(NA,2,NA,4,5,6), item2=c(NA,NA,3,4,5,NA), id=1:6) merge(x,y,by=c(id,item1,item2),all.x=T,all.y=T) #my rows are duplicated and the NA values are