Skip to content
Prev 309466 / 398506 Next

aggregate.formula: formula from string

Hi Thorn,

May be it is a bug in aggregate.formula().? Not sure about it.

The solutions that I gave and yours were returning the colnames as NA.? 

I guess this should be much better in terms of getting the result in one step.

?do.call(aggregate,list(mF,d,mean))
#? a b?????????? y?????????? z
#1 1 A -1.48354978 -0.37141485
#2 2 A -0.08862713? 0.35359250
#3 3 A? 1.17519518 -0.47595290
#4 1 B? 0.10214686 -0.70005131
#5 2 B? 0.41185154? 0.03707291
#6 3 B? 0.20507062 -0.67946389
A.K.




----- Original Message -----
From: "Thaler,Thorn,LAUSANNE,Applied Mathematics" <Thorn.Thaler at rdls.nestle.com>
To: arun <smartpink111 at yahoo.com>
Cc: R help <r-help at r-project.org>
Sent: Wednesday, October 31, 2012 8:30 AM
Subject: RE: [R] aggregate.formula: formula from string

Dear Arun,

Thanks for your suggestion, that does the trick. Just because I'm curious, where does the problem come from? I figured that wrapping the formula object in brackets would work as well:

aggregate((mF), d, mean)

So I guess it has something to do with the scope of mF, or what is the root cause?

Thanks for your help!


KR,

-Thorn