[R] Value between which elements of a vector?

beatleb rhelpforum at gmail.com
Tue Apr 5 13:20:40 CEST 2011


Dear R-useRs,

I am looking for a why to perform the following:

specialweeks<-c(0,2,5,12,18,19,20)
weeks<-c(1:30)

Now I would like that for every week it is even between which elements of
vector special weeks it is.
For weeks after 20, the value NA or 20, or even 20-30is fine.

Thus for 
week 1: 0-2
week 2: 2-5
week 3: 2-5
week 4: 2-5
week 5: 5-12 
ect.... 

It is not relevant if those intervals are captured in a matrix, in a vector
or whatever. 

I hope that you can help me!

With best regards,

Brenda Grondman



--
View this message in context: http://r.789695.n4.nabble.com/Value-between-which-elements-of-a-vector-tp3427751p3427751.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list