From p.dalgaard at biostat.ku.dk  Sun Apr  3 23:49:15 2005
From: p.dalgaard at biostat.ku.dk (Peter Dalgaard)
Date: Sun Apr  3 23:49:23 2005
Subject: [Rd] Error: NAs are not allowed in subscripted assignments:
	change from R.1.9
In-Reply-To: <C698D707214E6F4AB39AB7096C3DE5A58FFAC1@phost015.EVAFUNDS.intermedia.net>
References: <C698D707214E6F4AB39AB7096C3DE5A58FFAC1@phost015.EVAFUNDS.intermedia.net>
Message-ID: <x2br8vv8dg.fsf@turmalin.kubism.ku.dk>

"Vadim Ogranovich" <vograno@evafunds.com> writes:

> Hi,
> 
> There seems to be a change in 2.0.1 in the workings of subscript
> assignments with missing values.
> 
> 
> # This is R.2.0.1
> 
> # assignment w/ missing index doesn't work when right-hand-side is a
> matrix. It did work in 1.9.1
> > x = matrix(1, 2, 2); x[c(1,NA),] = x
> Error: NAs are not allowed in subscripted assignments
> # it does work for a vector
> > x = matrix(1, 2, 2); x[c(1,NA),] = 1
> 
> Is this change intentional? There seems to be nothing about it in the
> release notes.

Yes, and oh yes there is, for the version where it changed, in ONEWS:

    o   Subassignments involving NAs and with a replacement value of
        length > 1 are now disallowed.  (They were handled
        inconsistently in R < 2.0.0, see PR#7210.)  For data frames
        they are disallowed altogether, even for logical matrix indices
        (the only case which used to work).


-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907


[Rd] Error: NAs are not allowed in subscripted assignments: change from R.1.9
Peter Dalgaard