I have a vector v
and I want to find all those elements, that have values between 4 and 7.
v = c(1:9)
# indices of elements with values larger than 4
which(v > 4)
# indices of elements with values smaller than 7
which(v < 7)
v>4
and v<7
give boolean vectors, which I'd like to combine. I tried the following, which did not work for me,...
# combination?
matching = which(v>4 && v<7) # does not work
How can I applay a boolean operation on two boolean vectors, that gives me a resulting vector?
&
, which one can access using?"&"
. I look at that one at least once every week, since I can never get them straight... – Economically