powered by
whicht_run checks which element has value TRUE within specified running window.
whicht_run
which
whicht_run(x, k = 0L, which = "last", na_rm = TRUE, na_pad = FALSE, idx = 0L)
input logical vector where running which-true is calculated.
Running window size. By default window size equals length(x). Allow varying window size specified by vector of length(x)
length(x)
specifies whether "first" or "last" index is returned.
"first"
"last"
logical (default na_rm=TRUE) - if TRUE NA are replaced by last observed minimum prior to element.
na_rm=TRUE
TRUE
NA
logical (default na_pad=FALSE) - if TRUE first k-results will be filled by NA. If k is not specified na_pad=F by default.
na_pad=FALSE
an optional integer vector containing indexes numbers of observation.
numeric vector of length equals length of x containing running index in k-long window.
x
k
# NOT RUN { x <- c( NA, FALSE, TRUE, NA, TRUE, FALSE, TRUE, TRUE) whicht_run( x, k=2, na_rm=TRUE, na_pad=FALSE ) # }
Run the code above in your browser using DataLab