Hi Lauri, here is a little modification of the solution for retrieving the last row only : score[as.vector(unlist(tapply(rownames(score), score$id, tail, 2))),] giving the last two rows. Replacing 2 by 6 or 10 gives you the last 6 or 10 rows (if they exist). Christian