[R] While loop

From: Rheannon <rbrooks_at_uvic.ca>
Date: Fri, 11 Jul 2008 10:06:34 -0700 (PDT)


I am trying to loop through a matrix column and find the first value <=0 and store that matrix location in a variable called Start.

I have tried the following:
i <- 1
j <- 1
while (Matrix[i, j] > 0)
i = (i + 1)
#loop until matrix [i, j] value <= 0
#strore that row number in a variable

Start <- i

I am getting a scripting out of bounds error and I suspect maybe the loop isnt stoping at the end of the matrix?

Any help is greatly appreciated!

View this message in context: http://www.nabble.com/While-loop-tp18408462p18408462.html
Sent from the R help mailing list archive at Nabble.com.

R-help_at_r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Fri 11 Jul 2008 - 17:53:48 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 11 Jul 2008 - 18:31:16 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive