[R] for loop should check the looping index !!

From: johan Faux <johanfaux_at_yahoo.com>
Date: Sat 14 Jan 2006 - 08:57:48 EST


Hello ,    

  a<-c(1)
  for(i in 2:length(a))

      do.something with a[[i]]    

  I get :
  Error in a[[i]] : subscript out of bounds    

  Am I missing something here? Doesnt R check the value of i inside "for" and if the condition is not tru, dont do anything ????    

  thanks,
  johan                         


 Got holiday prints? See all the ways to get quality prints in your hands ASAP.

        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Jan 14 09:07:40 2006

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:42:04 EST