[Rd] is.na<- problem
Rich FitzJohn
rich.fitzjohn at gmail.com
Thu Oct 20 02:43:02 CEST 2005
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:
> On 19-Oct-05 Gabor Grothendieck wrote:
> > In the following the first element of xx should have
> > been set to 0 but remains NA. Any comments?
> >
> >> xx <- c(NA,1)
> >> is.na(xx) <- 0
> >> xx
> > [1] NA 1
> >> R.version.string # Windows XP
> > [1] "R version 2.2.0, 2005-09-20"
>
> I wonder, has it ever worked? I get the same as you on
>
> R.version.string #Linux
> [1] "R version 1.6.2, 2003-01-10"
>
> R.version.string #Linux
> [1] "R version 1.8.0, 2003-10-08"
>
> R.version.string #Linux
> [1] "R version 2.1.0, 2005-04-08"
>
> with the exception of
>
> R.version.string #Linux
> [1] "R version 1.2.3, 2001-04-26"
>
> which does know about is.na()<- at all.
>
>
> Hmmm
> Ted.
>
>
>
>
>
>
> --------------------------------------------------------------------
> E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk>
> Fax-to-email: +44 (0)870 094 0861
> Date: 20-Oct-05 Time: 01:11:45
> ------------------------------ XFMail ------------------------------
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
--
Rich FitzJohn
rich.fitzjohn <at> gmail.com | http://homepages.paradise.net.nz/richa183
You are in a maze of twisty little functions, all alike
More information about the R-devel
mailing list