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 > retained - I instead want one row per ID > id item1 item2 > 1 1 NA 1 > 2 1 NA NA > 3 2 2 NA > 4 2 NA NA > 5 3 3 NA > 6 3 NA 3 > 7 4 4 4 > 8 5 5 5 > 9 6 6 NA > I think you only got the wrong (too complex) function. Try rbind(x,y)
Dieter ______________________________________________ R-help@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.