On Fri, 28 Nov 2008 22:01:15 -0000 (GMT), (Ted Harding) <[EMAIL PROTECTED]> wrote:
[...] > It is not! Oops, of course, I meant to say "return" rather than "set" :-/ [...] > NA can seem to have a bewildering logic, but it all becomes clear if > you interpret NA as "value unkown". > You asked for foo[foo$A == "b", ]. What happens is that when the test > foo$A == "b" encounters f$A[1] it sees NA, so it does not know what > the value is. Hence it does not know whether this row of foo satisfies > the test. Hence the entire row is of unkown status. Hence a row is > output all of whose elements (including the row label, i.e. the row > number) are flagged "unknown", i.e. NA. > AFter all, if it gave the value of foo$X[1] = 0.5013591, and you > subsequently acessed foo[foo$A == "b",][1,2] and got 0.5013591, you > would presumably proceed as though this was a value corresponding to a > case where foo$A == "b". But it is not -- since foo$A[1] = NA, you > don't know whether that is the case. Hence you don't know the value of > foo[foo$A == "b",][1,2]. > Clear? ( :)) Hoping this helps, Ted. Crystal! It's something that one needs to be extra careful with when playing with logicals. Thanks Ted, -- Seb ______________________________________________ R-help@r-project.org 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.