johan Faux <[EMAIL PROTECTED]> writes: > 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 ????
Well, > 2:1 [1] 2 1 The for loop as such has no idea what you're going to do with the index variable, so will faithfully try to do.something with a[[2]] -- O__ ---- Peter Dalgaard Ă˜ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
