Putting -0.01 in parenthesis works for me. Consider the following:

> DF <- data.frame(a=c(-2,2), b=3:4)
> DF[DF$a<(-1),]
  a b
1 -2 3

However, if I first do it without parentheses, then I've changed DF before I attempt to subset it:

DF[DF$a<-0.01,]
[1] a b
<0 rows> (or 0-length row.names)
> DF
    a b
1 0.01 3
2 0.01 4

This can create other problems, because now length(DF$a) == 1 (even though it printed as length 2):

> DF[DF$a<-1,]
    a b
1 0.01 3

hope this helps. spencer graves

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

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help



______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to