Re: [R] arithmetic comparison over corresponding values from two vectors

2009-02-10 Thread Charles C. Berry
On Tue, 10 Feb 2009, Keith Jewell wrote: sapply(trgroup, function(x) which(x>=starts & x <=ends)) works for your example data, but there's probably a better way For large scale problems this works well: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/60815.html HTH, Chuck HT

Re: [R] arithmetic comparison over corresponding values from two vectors

2009-02-10 Thread Keith Jewell
sapply(trgroup, function(x) which(x>=starts & x <=ends)) works for your example data, but there's probably a better way HTH KJ "T Joshi" wrote in message news:11417a880902100902w53664a3dq11aee64a963d8...@mail.gmail.com... > Hi, > I have scenario in which I wish to check whether numeric values

Re: [R] arithmetic comparison over corresponding values from two vectors

2009-02-10 Thread Marc Schwartz
on 02/10/2009 11:02 AM T Joshi wrote: > Hi, > I have scenario in which I wish to check whether numeric values in one array > falls within the range of numbers defined over corresponding values in two > other vectors: > > starts = c(12,45,67,110) > ends=c(24, 58,102,150) > > trgroup=c(18,87) > >

[R] arithmetic comparison over corresponding values from two vectors

2009-02-10 Thread T Joshi
Hi, I have scenario in which I wish to check whether numeric values in one array falls within the range of numbers defined over corresponding values in two other vectors: starts = c(12,45,67,110) ends=c(24, 58,102,150) trgroup=c(18,87) The result should be "1,3" , indices of vector starts/ends.