Re: [R] 'Apply' giving me errors

2011-10-21 Thread kickout
Thanks for the tips/adviceI actually used a different solution to circumvent this, but Uwe's solutions would also work -- View this message in context: http://r.789695.n4.nabble.com/Apply-giving-me-errors-tp3923880p3925377.html Sent from the R help mailing list archive at Nabble.com. ___

Re: [R] 'Apply' giving me errors

2011-10-21 Thread Kenn Konstabel
On Fri, Oct 21, 2011 at 3:09 AM, kickout wrote: > So i have a simple function: > > bmass=function(y){ > weight=y$WT*y$MSTR > return(bio) > } But this just returns "bio" and since an object with that name is not defined in the function, it will be looked up in the global environment (workspace) an

Re: [R] 'Apply' giving me errors

2011-10-21 Thread Uwe Ligges
On 21.10.2011 02:09, kickout wrote: So i have a simple function: bmass=function(y){ weight=y$WT*y$MSTR return(bio) } And want to apply to a whole bunch of rows in my data.frame: final1=apply(final,1,yldbu) BUT...recieve the following error: "Error in y$WT : $ operator is invalid for atomic

[R] 'Apply' giving me errors

2011-10-20 Thread kickout
So i have a simple function: bmass=function(y){ weight=y$WT*y$MSTR return(bio) } And want to apply to a whole bunch of rows in my data.frame: final1=apply(final,1,yldbu) BUT...recieve the following error: "Error in y$WT : $ operator is invalid for atomic vectors" However when i try: > final[