R-beta: get index numbers of vector?

Bill Simpson wsimpson at uwinnipeg.ca
Fri Apr 10 17:39:30 CEST 1998


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 at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list