Message-ID: <1319155776857-3923880.post@n4.nabble.com>
Date: 2011-10-21T00:09:36Z
From: kickout
Subject: 'Apply' giving me errors
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[1,]$WT*final[1,]$MSTR
[1] 156.3
It gives me the correct answer....what is apply not liking in my code?
Thanks
--
View this message in context: http://r.789695.n4.nabble.com/Apply-giving-me-errors-tp3923880p3923880.html
Sent from the R help mailing list archive at Nabble.com.