Skip to content
Prev 18139 / 63424 Next

is.na<- problem

Hi,

It does seem to be working as advertised, but not particulary
intuitively.  From ?is.na

  The generic function 'is.na<-' sets elements to 'NA'

In fact:
xx <- c(NA, 1)
is.na(xx) <- 2
xx
[1] NA NA

or is.na(xx) <- 5
[1] NA  1 NA NA NA

Looks like this was introduced in 1.4.0; from NEWS:
    o	New generic function is.na<-(), from S4.  This is by default
	equivalent to x[value] <- NA but may differ, e.g. for factors
	where "NA" is a level.

Cheers,
Rich
On 10/20/05, Ted Harding <Ted.Harding at nessie.mcc.ac.uk> wrote:
--
Rich FitzJohn
rich.fitzjohn <at> gmail.com   |    http://homepages.paradise.net.nz/richa183
                      You are in a maze of twisty little functions, all alike