[R] Noob question - Identity argument within aggregate function?

Sarah Goslee sarah.goslee at gmail.com
Fri Mar 2 23:35:14 CET 2012


Hi,

On Fri, Mar 2, 2012 at 3:51 PM, knavero <knavero at gmail.com> wrote:
>>aggregate(z, identity, mean)
>  1   2   3   4   5
> 1.0 3.0 5.0 6.0 7.5
>> aggregate(z, mean)
> Error: length(time(x)) == length(by[[1]]) is not TRUE
>
> Can someone help me understand the error above and why "identity" is
> necessary to satisfy the error

We can tell you to read ?aggregate and look at the order of the arguments.
We can point out that aggregate(z, mean) is not the same as mean(z), and
wonder what you are trying to accomplish with the former.

We can ask for a reproducible example, and some idea of what you are
trying to do.

Sarah


-- 
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-help mailing list