[R] replace

John Zhang jzhang at jimmy.harvard.edu
Fri Oct 11 20:38:37 CEST 2002


>Subject: [R] replace
>From: Peter Adamka <malmo at unitra.sk>
>To: r-help at stat.math.ethz.ch
>Content-Transfer-Encoding: 7bit
>Date: 11 Oct 2002 18:58:15 +0200
>Mime-Version: 1.0
>
>The thing I need to do is to replace NA values with 0.
>But I;m not able to determine how to do it.
>I'm relative new, pls Help.
>Malmo

Is this what you wanted?

tt <- c(1, 2, NA, NA, 5, NA)
tt[is.na(tt)] <- 0

tt now is:
tt
[1] 1 2 0 0 5 0

>
>
>
>-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
>r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
>Send "info", "help", or "[un]subscribe"
>(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
>_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list