[R] conditional less than

Corey Moffet cmoffet at nwrc.ars.usda.gov
Mon Oct 13 21:19:10 CEST 2003


x <- rnorm(100)

x[x < -1]
x[x<(-1)]
# both work for me!

x[x<-1]
# as you note gives problems. 

At 12:03 PM 10/13/2003 -0700, Brian J. Haag wrote:
>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/mailman/listinfo/r-help
>
With best wishes and kind regards I am

Sincerely,

Corey A. Moffet, Ph.D.
Support Scientist

University of Idaho
Northwest Watershed Research Center
800 Park Blvd, Plaza IV, Suite 105
Boise, ID 83712-7716

Voice: (208) 422-0718
FAX:   (208) 334-1502




More information about the R-help mailing list