Displaying 1 result from an estimated 1 matches for "rlex".
Did you mean:
alex
2003 Nov 14
2
bad performance of a function
Dear all
I need to find a length of true sequences in logical vector (see example 1). I found
a possible solution which is good but if I use it on a larger data set I experience a
substantial decrease in performance (example 2).
Example 1
set.seed(111)
x <- sample(c(T,F),50, replace=T)
system.time(cetnost <- as.numeric(table(which(x)-cumsum(x[which(x)]))))
[1] 0.00 0.00 0.03 NA NA