Skip to content
Prev 306268 / 398506 Next

mean-aggregate – but use unique for factor variables

In the absence of data via dput() or other wise ....

I would assume that if you made your function FUN something like:

function(x) if(is.factor(x)) unique(x) else mean(x)

(or maybe length(unique(x)) as first clause)

you'd get what you want.  No?

On Tue, Sep 25, 2012 at 2:32 PM, Martin Batholdy
<batholdy at googlemail.com> wrote: