

   GGrroouupp AAvveerraaggeess OOvveerr LLeevveell CCoommbbiinnaattiioonnss ooff FFaaccttoorrss

        ave(x, ..., FUN = mean)

   AArrgguummeennttss::

          x: A numeric.

        ...: Grouping variables, typically factors, all of the
             same `length' as `x'.

        FUN: Function to apply for each factor level combina-
             tion.

   DDeessccrriippttiioonn::

        Subsets of `x[]' are averaged, where each subset con-
        sist of those observations with the same factor levels.

   VVaalluuee::

        A numeric vector, say `y' of length `length(x)'.  If
        `...' is `g1,g2', e.g., `y[i]' is equal to `FUN(x[j]',
        for all `j' with `g1[j]==g1[i]' and `g2[j]==g2[i])'.

   SSeeee AAllssoo::

        `mean', `median'.

   EExxaammpplleess::

        data(warpbreaks)
        attach(warpbreaks)
        ave(breaks, wool)
        ave(breaks, tension)
        ave(breaks, tension, FUN = function(x)mean(x, trim=.1))
        plot(breaks, main =
             "ave( Warpbreaks )  for   wool  x  tension  combinations")
        lines(ave(breaks, wool, tension            ), type='s', col = "blue")
        lines(ave(breaks, wool, tension, FUN=median), type='s', col = "green")
        legend(40,70, c("mean","median"), lty=1,col=c("blue","green"), bg="gray90")
        detach()

