R: position element x[m]>value for which all subsequent elements i>m also x[i]>value -


on forum found ?which() command , applied on vector containing sequence of time indexed values follows:

first.element <- which(e>0)[1] 

to find first element e!=0 want sure subsequent elements >0 cos i'm not searching first element e>0 first elemtn 'e>0' subsequent elements in vector larger 0.

usually search on internet sooner or later delivers proper code time wasn't successful. if 1 of knows solution i'd thankful.

br

why don't reverse vector , find first 0?

which(rev(e)<=0)[1] 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -