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

William Dunlap wdunlap at tibco.com
Sat Jan 20 17:24:32 CET 2018


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]]



More information about the R-devel mailing list