Find the index of negative multiplying of two vectors in R -
i have 2 vectors , want find index of multipling of these 2 vectors gets negative , a[index]
is negative , b[index]
positive. how can find indexin r?
= c(1, -1, 2, 3, 4) b =c(-1, 3, 5, 4, -5) c = a*b
i have tried not desire result:
> which( c <= 0) [1] 1 2 5
the final result should index = 1 , 5.
after reading question 10 times, think regarded answer 2 simon0101 says.
which( < 0 & b >= 0 & c < 0)
please review zour question or expected result.
Comments
Post a Comment