From wdunlap at tibco.com  Sat Jan 20 17:24:32 2018
From: wdunlap at tibco.com (William Dunlap)
Date: Sat, 20 Jan 2018 08:24:32 -0800
Subject: [Rd] as.character(list(NA))
In-Reply-To: <5A6363B8.3030305@stern.nyu.edu>
References: <5A6363B8.3030305@stern.nyu.edu>
Message-ID: <CAF8bMcb3ON02efFcQi0rgErRyNxWt==z2sJ5_wuXytsFE7emLA@mail.gmail.com>

I believe that for a list as.character() applies deparse()  to each element
of the list.  deparse() does not preserve NA-ness, as it is intended to
make text that the parser can read.

> str(as.character(list(Na=NA, LglVec=c(TRUE,NA),
Function=function(x){x+1})))
 chr [1:3] "NA" "c(TRUE, NA)" "function (x) \n{\n    x + 1\n}"


Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Sat, Jan 20, 2018 at 7:43 AM, Patrick Perry <pperry at stern.nyu.edu> wrote:

> As of R Under development (unstable) (2018-01-19 r74138):
>
> > as.character(list(NA))
> [1] "NA"
>
> > is.na(as.character(list(NA)))
> [1] FALSE
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

	[[alternative HTML version deleted]]



[Rd] as.character(list(NA))
William Dunlap