From maechler at stat.math.ethz.ch  Thu Oct 20 11:34:18 2005
From: maechler at stat.math.ethz.ch (Martin Maechler)
Date: Thu, 20 Oct 2005 11:34:18 +0200
Subject: [Rd] is.na<- problem
In-Reply-To: <1129771685.5955.12.camel@localhost.localdomain>
References: <XFMail.051020011342.Ted.Harding@nessie.mcc.ac.uk>
	<1129769164.5955.5.camel@localhost.localdomain>
	<971536df0510191809v3a7cd3d0k753e95a71be027d3@mail.gmail.com>
	<1129771685.5955.12.camel@localhost.localdomain>
Message-ID: <17239.25754.59979.321531@stat.math.ethz.ch>

>>>>> "Marc" == Marc Schwartz <MSchwartz at mn.rr.com>
>>>>>     on Wed, 19 Oct 2005 20:28:05 -0500 writes:
   .............

    >> > In reviewing the Green Book on the top of page 143, it shows an example
    >> > in which the RHS of the assignment are the indices into the LHS object
    >> > which are to be set to NA. For example:
    >> >
    >> > > xx <- c(0:5)
    >> >
    >> > > xx
    >> > [1] 0 1 2 3 4 5
    >> >
    >> > > is.na(xx) <- c(3, 4)
    >> >
    >> > > xx
    >> > [1]  0  1 NA NA  4  5
    >> >
    >> >

   ...........

    Marc> In all honesty, while I understood the concept from reading the help
    Marc> page, it was not truly clear until I read the Green Book and saw the
    Marc> example as to how to actually use the function.

    Marc> It would probably be worthwhile to add an example of use to the help
    Marc> page.

good idea. I've added a version of yours:

(xx <- c(0:4))
is.na(xx) <- c(2, 4)
xx                     #> 0 NA  2 NA  4

Martin



[Rd] is.na<- problem
Martin Maechler