[R] Using NULL to my data?

David Winsemius dwinsemius at comcast.net
Mon May 9 17:55:53 CEST 2011


On May 9, 2011, at 10:07 AM, Nilza BARROS wrote:

> Dear R users,
>
> I am reading data from a file where there are some missing that are
> represented by -9999.00.
> I am using the command below.
> =====My original data ===========
>
> PARM = TMPC;T12X;T12N;DWPC;PALT;SKNT;DRCT;P24M;CLCL

snipped

> But  I need to feed my database. These missings should be  
> represented by
> NULL.
> I mean, all "NA" should be replaced by "NULL" in my database.

Do you mean a string that is spelled "NULL"

If so, try:

dfrm[is.na(dfrm)] <- "NULL"

> I am trying the command below to pick up the rows and columns with  
> NA but I
> don't know how to fill the original data :
>
> which(is.na(Alldados),arr.ind=TRUE)
>
> But I don't know how to replace each NA with NULL. I tried using  
> as.null but
> NA is not replace at all.

If you set a column of a data.frame to NULL , it will erase it.

>
> I hope someone could help me.
>
> Best Wishes,
> Nilza Barros
>

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list