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

kelseyann kremerke at mail.gvsu.edu
Fri Sep 30 01:37:00 CEST 2011


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-tp3858115p3858115.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list