From sfalcon at fhcrc.org  Wed Oct 25 23:23:21 2006
From: sfalcon at fhcrc.org (Seth Falcon)
Date: Wed, 25 Oct 2006 14:23:21 -0700
Subject: [Rd] NA handling in as.character applied to a list
Message-ID: <m24ptsay46.fsf@ziti.local>

Hi all,

In some circumstances, as.character applied to a list converts real
NA's into the string "NA".  Propagation of NAs is something R does
very well and unless there are good reasons for losing the NA, it
would improve the consistency w.r.t. NA handling for as.character to
behave differently.

Here's an example:

## Create a list with character, logical, and integer NA elements
v <- list(a=as.character(NA), b=NA, c=as.integer(NA))
sapply(v, is.na)

       a    b    c 
    TRUE TRUE TRUE 

sapply(as.character(v), is.na)

     <NA>    NA    NA 
     TRUE FALSE FALSE 

Thoughts?

+ seth

--
Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center
http://bioconductor.org




[Rd] NA handling in as.character applied to a list
Seth Falcon