Re: [R] find longest consecutive streak in double

2016-06-06 Thread Bert Gunter
Yes, see ?rle, as Jim indicated. Just wanted to add that there is an rpy2 package that enables you to use R within python, which may mean that you do not need to translate your python code. Or at least not all of it. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people k

Re: [R] find longest consecutive streak in double

2016-06-05 Thread Jim Lemon
Hi Nick, I think you want to get the maximum run length: jja<-runif(92,0,16) med_jja<-median(jja) med_jja [1] 7.428935 # get a logical vector of values greater than the median jja_plus_med<-jja > med_jja # now get the length of runs runs_jja_plus_med<-rle(jja_plus_med) # finally find the maximum r

[R] find longest consecutive streak in double

2016-06-05 Thread Nick Tulli
Hey guys. Learning R after gaining a background in Python this year, and I'm translating my Python projects to R now. This is the first time I'm posting to the mailing list. Essentially, I have 92 data points in one double that I created from a netcdf file. Those 92 data points represent a measure