Skip to content
Prev 319116 / 398503 Next

Finding where a string drops below a certain value

Hello,

The following functions will return an index to the required values, not 
the values themselves.


firstzero <- function(x) which(x == 0)[1]
lastone <- function(x){
	z <- firstzero(x)
	if(z == 1) NULL else z - 1
}


Hope this helps,

Rui Barradas


Em 09-03-2013 12:53, Williams,Caroline escreveu: