[R] Replace Values in Matrix

baptiste auguie baptiste.auguie at googlemail.com
Fri Nov 27 19:19:03 CET 2009


Hi,

Try this,

matrizt[is.na(matrizt)] <- 0

HTH,

baptiste

2009/11/27 Romildo Martins <romildo.martins at gmail.com>:
> Hello,
>
> how to replace the "NA" by number zero?
>
>> matrizt
>                 [,1]           [,2]             [,3]        [,4]
> [1,] 1.0000000            NA             NA         NA
> [2,] 0.6717685 0.1453253             NA         NA
> [3,] 0.3971276 0.1493241 0.14532526         NA
> [4,] 0.1493241 0.1453253 0.06795269 0.06217967
>
>
> Thanks!
>
> Romildo
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>




More information about the R-help mailing list