I have a 5 column matrix like

12 10 8 6 3
10 9 8 7 5
14 NA 4 NA NA NA
15 NA 10 NA 5
...

I want to select the position of the first entry for each row <=5

for example, for the first row, I want to select the last element and return
its position as 5;
for th e third row, I want to select the third element and return its
position as 3;
similarly for the 4th row, I want to select the fifth element and return its
position 5.

I am wondering how to do this fast? Thanks a lot!

	[[alternative HTML version deleted]]

