[R] by Function Result Factor Levels

Dario Strbenac dstr7320 at uni.sydney.edu.au
Wed Sep 16 08:00:25 CEST 2015


Good day,

Yes, exactly. I found that aggregate is another alternative which doesn't require a package dependency, although the column formatting is less suitable, always prepending x.

aggregate(warpbreaks[, 1], warpbreaks[, 2:3], function(breaks) c(Min = min(breaks), Med = median(breaks), Max = max(breaks)))
  wool tension x.Min x.Med x.Max
1    A       L    25    51    70
2    B       L    14    29    44
3    A       M    12    21    36
4    B       M    16    28    42
5    A       H    10    24    43
6    B       H    13    17    28

--------------------------------------
Dario Strbenac
PhD Student
University of Sydney
Camperdown NSW 2050
Australia


More information about the R-help mailing list