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, Willi
Dear R-helpers,
I am stuck on a problem, and hope someone can help. I am trying to find the
time point in a time series where the values drop below a baseline threshold,
defined by the mean +/- standard deviation calculated on the last 6 time points
of the series. Here is a simplified example:
2 matches
Mail list logo