Dear Petr Savicky, Thank you very much for the solution. your script really worked for my DF, and yes as per your guess , its always ---> DF[i, "col2"] == DF[i+1, "col1"] Regards, karthick -- View this message in context: http://r.789695.n4.nabble.com/DF-grouping-tp4381310p4381646.html Sent from the R help mailing list archive at Nabble.com.