Hello,
I am dealing with numeric vectors 10^5 to 10^6 elements long. The values are
sorted (with duplicates) in the vector (v). I am obtaining the length of
vectors such as (v < c) or (v > c1 & v < c2), where c, c1, c2 are some scalar
variables. What is the most efficient way to do this?
I am using sum(v < c) since TRUE's are 1's and FALSE's are 0's. This seems to
me more efficient than length(which(v < c)), but, please, correct me if I'm
wrong. So, is there anything faster than what I already use?
I'm running R 2.14.2 on Linux kernel 3.4.34.
I appreciate your time,
Mikhail
[[alternative HTML version deleted]]