[R] conditional less than

Henrik Bengtsson hb at maths.lth.se
Mon Oct 13 21:22:01 CEST 2003


Add a spaces!

hist(sp$p[sp$r > 0.01])   
hist(sp$p[sp$r < -0.01])  

compare with

hist(sp$p[sp$r <- 0.01])  

which is what you tried.

Cheers.

Henrik Bengtsson
Lund University


> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch 
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Brian J. Haag
> Sent: den 13 oktober 2003 21:03
> To: r-help at stat.math.ethz.ch
> Subject: [R] conditional less than
> 
> 
> I'm sure this is a total noob question, but half an
> hour of searching bore no fruit: How do you select a
> subset of a vector by negative value?  If I try
> 
> > hist(sp$p[sp$r>0.01])   # all is well
> > hist(sp$p[sp$r<-0.01])  # this obviously causes
> issues
> 
> Also, putting -0.01 in parentheses didn't help.
> 
> Thanks in advance --
> 
> b
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list 
> https://www.stat.math.ethz.ch/mailma> n/listinfo/r-help
> 
>




More information about the R-help mailing list