Peter,

You're right ... and I do think I've finally understood the help file on this.  I somehow missed the connection between my variable's values, which include NAs, and the fact that those returned values are in turn indices for '['.

OK ... I'm all straight on this now.  (I lost count of how many times I read the help file ... it'd be great if the help page could be updated with a specific example on this sublety .... that's just a thought).

Thanks again to all for your patience with me on this,
Mauricio
New Jersey, USA



________________________________
 From: Peter Ehlers <ehlers@ucalgary.ca>

Cc: William Dunlap <wdunlap@tibco.com>; David Winsemius <dwinsemius@comcast.net>; peter dalgaard <pdalgd@gmail.com>; "r-help@r-project.org" <r-help@r-project.org> 
Sent: Tuesday, August 28, 2012 2:08 PM
Subject: Re: [R] Inexplicably different results using subset vs bracket notation on logical variable

On 2012-08-28 07:44, Mauricio Cornejo wrote:
> William, David, and Peter,
>
>
> Thank you all so much for your help on this.  Though I had read the help files on 'subset' and '[', I had not been able to discern from that text what the problem was.  I could not have solved it without your help.
>
>
> The help file on 'subset' mentions "For ordinary vectors, the result is simply x[subset & !is.na(subset)]."  However, since I was dealing with a data frame at the time, I failed to appreciate the relevance (but I get it now).
>
>
> I've gone back to read the help on '[' and I still don't see where this functionality is described.  The page has section titled "NAs in indexing", whose content I interpret as being limited to NAs in the indices (and not in the returned values).  I can't find any text in the documentation describing the subtle behavior you kindly pointed out.

Hmmm, it seems to me that the page is clear:

   "... NA index picks an unknown element and so *returns* NA
    in the corresponding element of ..."

(my emphasis)

Isn't that exactly what occurs?

Peter Ehlers

>
> Thanks again,
> Mauricio
>     [[alternative HTML version deleted]]
>
	[[alternative HTML version deleted]]


