Hi @ all, I wamnt to combine two dataframes including a condition. I have two dataframes like the following:
animal<-c("bear","bear","lion","monkey","fish","monkey","bear","zebra","zebra") val<-c(2,42,67,5,12,9,87,1,12) place<-c("S","N","N","Z","R","O","E","I","Q") df1<-data.frame(animal,val,place) animal<-c("bear","bear","lion","monkey","fish","monkey","bear","zebra","zebra") val<-c(21,45,78,6,18,77,89,17,28) place<-c("S","N","N","Z","R","G","O","P","Q") df2<-data.frame(animal,val,place) I would like to merge them with a condition. If "animal" and "place" are eqal in both df's, then add the values. If not add all three parameters ("animal","value","place") at the bottom (like rbind). I hope somebody can help me. Thank a lot. geo -- View this message in context: http://r.789695.n4.nabble.com/merge-dataframes-with-condition-tp4649605.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.