Searched for "by" in forums and no hits, should be simple problem. This is my line:>bio.mean<-by(Data,Plot, function(x) mean(AbvBioAnnProd))I want to calculate the mean of "AbvBioAnnProd" in each Plot. What am I doing wrong? Thanks in advance, -AL -- View this message in context: http://www.nabble.com/Help-with-%22by%22-tp22887127p22887127.html Sent from the R help mailing list archive at Nabble.com.
AllenL wrote:> Searched for "by" in forums and no hits, should be simple problem. > > This is my line: >> bio.mean<-by(Data,Plot, function(x) mean(AbvBioAnnProd)) > > I want to calculate the mean of "AbvBioAnnProd" in each Plot. What am I > doing wrong?What is AbvBioAnnProd? I only see that you pass Data, Plot and the parts of Data subscripted by Plot as x into the anonymous function, but there is no AbvBioAnnProd that mean can use so far ... You need to tell us why R should know anything about that object. Uwe Ligges> > Thanks in advance, > -AL >
On Apr 4, 2009, at 3:42 PM, AllenL wrote:> > Searched for "by" in forums and no hits, should be simple problem.The help page for by must surely have have *some* information?> > > This is my line: >> bio.mean<-by(Data,Plot, function(x) mean(AbvBioAnnProd)) > > I want to calculate the mean of "AbvBioAnnProd" in each Plot. What > am I > doing wrong?A) You are not providing an example that can be worked on. B) You are not providing the output of your session. C) You are not describing Data, Plot and AbvBioAnnProd. Wild assed guess: bio.mean <- by(Data$AbvBioAnnProd, Data$Plot, mean )>David Winsemius, MD Heritage Laboratories West Hartford, CT