[R] NAs - NAs are not allowed in subscripted assignments

Gabor Csardi csardi at rmki.kfki.hu
Thu Jul 24 21:01:04 CEST 2008


On Thu, Jul 24, 2008 at 10:39:34AM -0700, Nordlund, Dan (DSHS/RDA) wrote:
[...]
> Yes, it does help.  I was misunderstanding how logical values are
> used for indexing.  I assumed incorrectly that a value would be
> returned only if the index expression evaluated as TRUE.  It would
> seem that the philosophy is that not returning a value would imply
> that the expression evaluated to FALSE.  So, indexing with NA must
> return something, and NA is the appropriate value to return since one
> doesn't know what it is. 
> 
> Is that a reasonable summary?

Yes, I think so. (But I have to say that I'm not completely aware of
the ideology behind this choice.)

Gabor

> Dan 
> 
> Daniel J. Nordlund
> Washington State Department of Social and Health Services
> Planning, Performance, and Accountability
> Research and Data Analysis Division
> Olympia, WA  98504-5204
>  
>  
> 

-- 
Csardi Gabor <csardi at rmki.kfki.hu>    UNIL DGM



More information about the R-help mailing list