Hello, I am trying to identify values that fall within a certain range. I thought that I might be able to use the which function to do this but I have been unable to figure out a way to do it. Perhaps a little code will illustrate what i am trying to do. a <- rnorm(1000, 100, 50) which( 100 < a <= 200) of course this doesn't work but illustrates what I ma trying to do, If anyone has suggestions I would greatly appreciate it Best, Spencer [[alternative HTML version deleted]]
Try : which(a > 100 & a<= 120) On Fri, Jul 18, 2008 at 3:42 PM, sj <ssj1364 at gmail.com> wrote:> Hello, I am trying to identify values that fall within a certain range. I > thought that I might be able to use the which function to do this but I have > been unable to figure out a way to do it. Perhaps a little code will > illustrate what i am trying to do. > > > a <- rnorm(1000, 100, 50) > which( 100 < a <= 200) > > > of course this doesn't work but illustrates what I ma trying to do, If > anyone has suggestions I would greatly appreciate it > > Best, > > Spencer > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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. >-- Henrique Dallazuanna Curitiba-Paran?-Brasil 25? 25' 40" S 49? 16' 22" O
On Fri, 18 Jul 2008 11:42:09 -0700, sj <ssj1364 at gmail.com> wrote: [...]> a <- rnorm(1000, 100, 50) which( 100 < a <= 200)> of course this doesn't work but illustrates what I ma trying to do, If > anyone has suggestions I would greatly appreciate itHave a look at ?& -- Seb
Do simply which(a<100 & a>=200) Julian sj wrote:> Hello, I am trying to identify values that fall within a certain range. I > thought that I might be able to use the which function to do this but I have > been unable to figure out a way to do it. Perhaps a little code will > illustrate what i am trying to do. > > > a <- rnorm(1000, 100, 50) > which( 100 < a <= 200) > > > of course this doesn't work but illustrates what I ma trying to do, If > anyone has suggestions I would greatly appreciate it > > Best, > > Spencer > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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.