[R] is.na()<- on a character vector
w||||@mwdun|@p @end|ng |rom gm@||@com
Fri Dec 16 20:14:24 CET 2022
I think that
is.na(x) <- i
generally does the same to x as does
x[i] <- NA
I say 'generally' because some classes (e.g., numeric_version) do not allow
x[i]<-NA but do allow is.na(x)<-i. It is possible that some classes mess
up this equivalence, but I think that would be considered a bug.
On Fri, Dec 16, 2022 at 10:29 AM Göran Broström <goran.brostrom using umu.se>
> I'm confused:
> > x <- 1:2
> > is.na(x) <- 1
> > x
>  NA 2
> OK, but
> > x <- c("A", "B")
> > is.na(x) <- "A"
> > x
> "A" "B" NA
> What happens?
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
[[alternative HTML version deleted]]
More information about the R-help