R-beta: get index numbers of vector?

Bill Simpson (wsimpson@uwinnipeg.ca)
Fri, 10 Apr 1998 10:39:30 -0500 (CDT)


Date: Fri, 10 Apr 1998 10:39:30 -0500 (CDT)
From: Bill Simpson <wsimpson@uwinnipeg.ca>
To: r-help <r-help@stat.math.ethz.ch>
Subject: R-beta: get index numbers of vector?

I have ordered x,y data. Suppose I have
y<-c(1,2,3,4,5,6,5,4,3,2,1)
x<-c(.1,.2,.3,.4,.5,.6,.7,.8,.9,1.0,1.1)

I want a function left(y,3) which returns the index of the first y value
>3.
left(y,3)
4
And a similar one,
right(y,3)
8
(The basic idea is I want the left and right edge of a bump
where it is sliced at some y-level.  But I want the index numbers)

I can't figure out how to get the index numbers.
y[y>3]
gives me
4 5 6 5 4

Thanks very much for any help!

Bill Simpson

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._