> As Peter said, it's the value that counts, not the way you calculated > it. If you print -c(2,3,5) you get three negative numbers. If you > print -integer(0), you don't get any. The first case is asking for > elements to be left out, the second isn't. > > The moral of the story is to use logical indices rather than negative ones: > > dubious.records <- peoples.heights$heights > 2.5 > peoples.heights = peoples.heights[!dubious.records,]
Unfortunately, there are some "matching" functions that return numeric indices, not logical vectors (eg. grep). For this case I created an "unwhich" function - but is there a better way to proceed? Hadley ______________________________________________ [email protected] 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.
