day, July 18, 2011 3:10 PM
> To: Greg Snow; jim holtman; Manuel K.
> Cc: r-help@r-project.org
> Subject: RE: [R] Number in interval
>
> Note that the precendence of %<=% is not the
> same as that of <=, so you can be surprised by its
> behavior in slightly more comple
half Of Greg Snow
> Sent: Monday, July 18, 2011 1:39 PM
> To: jim holtman; Manuel K.
> Cc: r-help@r-project.org
> Subject: Re: [R] Number in interval
>
> A small modification of this would be:
>
> > library(TeachingDemos)
> > -3 %<=% z %<=% 3
>
> Whether t
tical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of jim holtman
> Sent: Sunday, July 17, 2011 3:29 PM
> To: Manuel K.
> Cc: r-help@r-pr
Thank you Jim, Steve and David.
I found findIntervals to work best for my problem.
Manuel
--
View this message in context:
http://r.789695.n4.nabble.com/Number-in-interval-tp3673537p3674969.html
Sent from the R help mailing list archive at Nabble.com.
_
On Jul 17, 2011, at 5:29 PM, jim holtman wrote:
try this:
z <- c(-1.4,0.5,4.7)
(z >= -3) & (z <= 3)
[1] TRUE TRUE FALSE
Another way:
> findInterval(z, c(-3,3)) == 1
[1] TRUE TRUE FALSE
> z=c(-50,-1.4,0.5,4.7)
And just to prove to myself that it behaves as I expect with values
be
Also check out the 'cut' and 'findIntervals' functions if you need to
check for many intervals at once.
On Sunday, July 17, 2011, jim holtman wrote:
> try this:
>
>> z <- c(-1.4,0.5,4.7)
>> (z >= -3) & (z <= 3)
> [1] TRUE TRUE FALSE
>>
>
>
> On Sun, Jul 17, 2011 at 10:54 AM, Manuel K. wrote:
try this:
> z <- c(-1.4,0.5,4.7)
> (z >= -3) & (z <= 3)
[1] TRUE TRUE FALSE
>
On Sun, Jul 17, 2011 at 10:54 AM, Manuel K. wrote:
> Hi all,
>
> I have an interval (e.g [-3,3]) and a numeric vector z (-1.4,0.5,4.7). How
> can I test whether an element in z lies between between -3,3? I particul
7 matches
Mail list logo