From oehl_list@gmx.de  Wed Jul  3 14:30:41 2002
From: oehl_list@gmx.de (oehl_list@gmx.de)
Date: Wed, 3 Jul 2002 15:30:41 +0200 (MET DST)
Subject: wrong measurements on as.character(NA) (PR#1739)
Message-ID: <200207031330.PAA09412@pubhealth.ku.dk>


pure replication code at the end

> ## this is correct
> nchar("NA")
[1] 2
> 
> # but this is wrong since 1.5.0
> nchar(NA)
[1] 2
> nchar(as.character(NA))
[1] 2
> 
> 
> # same problems with strwidth() strheight()
> plot(1)
> strwidth("NA")
[1] 0.03410118
> strwidth(NA)
Error in strwidth(s, pmatch(units, c("user", "figure", "inches")), cex) : 
        character or expression first argument expected
> strwidth(as.character(NA))
[1] 0.03410118
> 
> strheight("NA")
[1] 0.02235669
> strheight(NA)
Error in strheight(s, pmatch(units, c("user", "figure", "inches")), cex) : 
        character or expression first argument expected
> strheight(as.character(NA))
[1] 0.02235669


I guess, all of the following should return NA

nchar(NA)
strwidth(NA)
strheight(NA)

Best 


Jens Oehlschlgel



## this is correct
nchar("NA")

# but this is wrong since 1.5.0
nchar(NA)
nchar(as.character(NA))


# same problems with strwidth() strheight()
plot(1)
strwidth("NA")
strwidth(NA)
strwidth(as.character(NA))

strheight("NA")
strheight(NA)
strheight(as.character(NA))


--please do not edit the information below--

Version:
 platform = i386-pc-mingw32
 arch = i386
 os = Win32
 system = i386, mingw32
 status = 
 major = 1
 minor = 5.1
 year = 2002
 month = 06
 day = 17
 language = R

Windows 2000 Professional (build 2195) Service Pack 1.0

Search Path:
 .GlobalEnv, package:SJava, package:ctest, Autoloads, package:base

-- 




-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


wrong measurements on as.character(NA) (PR#1739)
oehl_list@gmx.de