[Rd] is.na<- problem

Martin Maechler maechler at stat.math.ethz.ch
Thu Oct 20 11:34:18 CEST 2005


>>>>> "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



More information about the R-devel mailing list