got it... another merge did the trick narrow6<-merge(narrow2,narrow5,by=c("gene","gender")) Thanks for the help Rui -- View this message in context: http://r.789695.n4.nabble.com/Mean-of-matched-data-tp4636856p4636877.html Sent from the R help mailing list archive at Nabble.com.