[Rd] type.convert() does not treat "NA" as ordinary string as intended from version 1.5 (PR#1567)

oehl_list@gmx.de oehl_list@gmx.de
Fri, 17 May 2002 14:59:04 +0200 (MET DST)


# replication code at end of mail

> # As from R 1.5 
> 
> identical(as.character(NA), "NA")
[1] FALSE
> 
> # there is no longer a fundamental difference between "NA" 
> # and an ordinary string like "NN" (WHICH IS A GREAT IDEA!!)
> # however, though "NA" is not given as na.strings we have
> 
> type.convert(c("NA", "1", NA), na.strings="b")
[1] NA  1 NA
> # compare to
> type.convert(c("NN", "1", NA), na.strings="b")
[1] NN   1    <NA>
Levels:  1 NN NA 
> 
> # dito
> type.convert(c("NA", "1", NA), na.strings=character())
[1] NA  1 NA
> # compare to
> type.convert(c("NN", "1", NA), na.strings=character())
[1] NN   1    <NA>
Levels:  1 NN NA 
 
 
# furthermore, may be type.convert should have default
# function(x, na.strings = NA, as.is = FALSE, dec = ".")
# or 
# function(x, na.strings = character(), as.is = FALSE, dec = ".")
# or 
# function(x, na.strings = NULL, as.is = FALSE, dec = ".")
# rather then
# function(x, na.strings = "NA", as.is = FALSE, dec = ".")


# As from R 1.5 

identical(as.character(NA), "NA")

# there is no longer a fundamental difference between "NA" 
# and an ordinary string like "NN" (WHICH IS A GREAT IDEA!!)
# however, though "NA" is not given as na.strings we have

type.convert(c("NA", "1", NA), na.strings="b")
# compare to
type.convert(c("NN", "1", NA), na.strings="b")

# dito
type.convert(c("NA", "1", NA), na.strings=character())
# compare to
type.convert(c("NN", "1", NA), na.strings=character())



-- 




-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._