[R] ave documentation

John Christie John.Christie at Dal.Ca
Wed Oct 1 19:56:15 CEST 2014


Hi,

I was looking at the ave documentation and it seems awfully sparse. How about we change the description from:

Subsets of x[] are averaged, where each subset consist of those observations with the same factor levels.

to:

Subsets of x[] are averaged, where each subset consist of those observations within a combination of factor levels. The result will have the same length as x[].

Maybe that's not just what I want either. ave is so useful any time you want to basically split/apply and want the output to be the same lenghth. Here's an example...

x <- c('a', 'a', 'b', 'b', 'c', 'c', 'a', 'a')
f <- c(1, 1, 1, 1, 2, 2, 2, 2)
ave(x, f, FUN = order )

One would never have deduced that from the help alone and it seems like a primary function. Or, more advanced

as.numeric( ave(x, f, FUN = function(x) factor(x, levels = unique(x))) )

And if this isn't where I'd send help documentation suggestions where could I?


More information about the R-help mailing list