[R] an issue about removing "NA"s from an array

Bert Gunter gunter.berton at gene.com
Fri Jun 21 18:13:51 CEST 2013


You really really need to do your homework.

?NA

-- Bert

On Fri, Jun 21, 2013 at 8:59 AM, Yasin Gocgun <entropy053 at gmail.com> wrote:
> Hi,*
>
> *I would like to set the entries of an array that appear as "NA" to a
> certain integer, but did not find a way to do so. The related code is given
> below:
>
> A <- array(-1000 , dim=c(100) );
>
> for(i in 1: 100 ){
>      A[i] =B[i,57] -  B[i,5];
> }
>
> A [ which( A == "NA") ] <- 900;
>
> The "NA"s still appear as the entries of the array A.
>
> Can you tell me what is missing here? (I also tried setting the entries of
> A to character using "as.character" but it did not work)
>
> Thanks,
>
>
> --
> Yasin Gocgun
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm



More information about the R-help mailing list