Hi again, Sorry for disturbing. After posting I suddenly found a solution. As it may help someone else here it goes.
df du1 <- duplicated(df[,c("St.Sam","Species")],fromLast = F) du2 <- duplicated(df[,c("St.Sam","Species")],fromLast = T) X <- df[du1|du2,] aggRows <- aggregate(cbind(NT,PT) ~St.Sam+Species+Var1+Var2, X,sum) dfNew <- rbind(df[!(du1|du2),], aggRows) Just need to "polish" dfNew and its OK. But maybe there is a more elegant solution. Cheers, Tito -- View this message in context: http://r.789695.n4.nabble.com/aggregate-and-sum-on-some-columns-fromduplicate-rows-tp4686040p4686043.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.