[R] For loop for subset - repeating same over and over?

B77S bps0002 at auburn.edu
Fri Sep 30 04:26:52 CEST 2011


The first suggestion would be to use dput() to allow people on here to access
your data.  
see ?dput

I think you will want to post the output from:

dput(QInflAvgbyPlot)   ## or whatever object contains your data






kelseyann wrote:
> 
> Hello, I am using the following script to run an anova for numerous
> species in a table that I have:
> 
> 
> SiteSpp <-
> c("ADHALP","ADLCON","ADLARC","BDALAT","BDPARC","BDLCON","BDLARC","AWCAQU","AWERUS","AWEANG","AWDPSI","BWCSTA","BWHPAU","BWETRI","BWERUS","BWDFIS","BWPARC","BWLCON","BWLARC","BWJBIG")
> 
> n.SiteSpp <- length(SiteSpp)
> 
>   for (i in (1:n.SiteSpp)) {
>       QInfl.aov <- aov(AvgOfnumResponse ~ strTrea*strYear,
> data=QInflAvgbyPlot, subset=(SiteSpp == SiteSpp[i]))
>       print(summary(QInfl.aov))
>   }
> 
> 
> The resulting summary just continuously prints the same anova results (For
> ADHALP) over and over again.... Any suggestions?
> 
> Thanks,
> Kelsey
> 


--
View this message in context: http://r.789695.n4.nabble.com/For-loop-for-subset-repeating-same-over-and-over-tp3858115p3858421.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list