On 2 Jan 2003 at 7:58, Sundar Dorai-Raj wrote:

> Tord,
> 
> Tord Snall wrote:
> > Dear all,
> > I try to summarise my data per category using aggregate, but for
> > some reason I get the error message "sum" not meaningful for factors
> > even though my vector is numeric. The data set is shown below.
> > 
> > Could someone please give a hint.
> > 
> > Thanks in advance!
> > 
> > Sincerely,
> > Tord
> > 
> > 
> 
> aggregate requires the first argument to be numeric if you're using
> sum 
>   or mean. The way you had it, aggregate was trying to sum your 
> classification variable as well which is of class `factor'. Try the
> following instead.
> 
> > aggregate(list(tallstubbyta = test$tallstubbyta,
>              list(ObjektID = test$ObjektID), sum)

Or

aggregate(test$tallstubbyta,list(test$ObjectID),sum)




> 
> Regards,
> Sundar


Cheers
Petr Pikal
[EMAIL PROTECTED]
[EMAIL PROTECTED]

______________________________________________
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to