[Rd] is.na<- problem
Marc Schwartz
MSchwartz at mn.rr.com
Thu Oct 20 14:58:24 CEST 2005
On Thu, 2005-10-20 at 11:34 +0200, Martin Maechler wrote:
> >>>>> "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
Great!
Thanks Martin!
Marc
More information about the R-devel
mailing list