Check the package doBy as well (pretty handy for analysis of grouped data). library(doBy) summaryBy(PM~ID,data=d,FUN=median) HTH, -Girish -- View this message in context: http://n4.nabble.com/median-of-grouped-data-tp1311971p1312386.html Sent from the R help mailing list archive at Nabble.com.