>> Using paste(Site,Prof) when calling ave() is ugly, in that it >> forces you to consider implementation details that you expect >> ave() to take care of (how does paste convert various types >> to strings?). It also courts errors since paste("A B", "C") >> and paste("A", "B C") give the same result but represent different >> Site/Prof combinations. > > Well, ave() uses interaction(...) and interaction() has a "drop" argument, so > >> with(x, ave(H, Site, Prof, drop=TRUE, FUN=function(y)y-min(y))) > [1] 8 0 51 0 33 22 21 0
I don't understand why this isn't the default. Hadley -- Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University http://had.co.nz/ ______________________________________________ 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.