Dear All,
I would like to ask a question about how to locate the indices after comparing 
two numeric vectors.
Say, I have,  A <- c(1,2,3,4) and  A <- c(0,3,1,5)
and we cmpare: 
>  idx <- A<B
So:
> idx
[1] FALSE  TRUE FALSE  TRUE

Question 1: 
I would like to get a vector that stores the indices for entries of A such that 
this relationship is true. In this case,
a vector  idx1 < c(2,4), because the 2nd and 4th entries of A satisfy the 
conditions

Question 2:
I would like to know the maximum index of the entry in A for which the 
relationship is true. In this case,
max_indx = 4, since the 4th entry of A is such.

Could you please give me some hints?

Thank you,
-Chee

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to