[Rd] as.numeric - Possible error (PR#870)
maechler@stat.math.ethz.ch
maechler@stat.math.ethz.ch
Fri, 9 Mar 2001 10:08:38 +0100 (MET)
>>>>> "harald" == harald fekjar <harald.fekjar@basalmed.uio.no> writes:
harald> Full_Name: Harald Fekjær
harald> Version: 1.22
harald> OS: Windows
harald> Submission from: (NULL) (158.36.132.220)
harald> Dear R developers
harald> Is this done with purpose...:
harald> In R I get:
harald> ---
>> as.numeric(" ")
harald> [1] 0
>> as.integer(" ")
harald> [1] 0
harald> ---
harald> While in the same in S-PLUS returns:
harald> ---
>> as.numeric(" ")
harald> [1] NA
>> as.integer(" ")
harald> [1] NA
harald> ---
harald> For my applications, the later (S-PLUS) definitely makes most
harald> sense, but you my have some good reasons for your choose?
harald> (Anyway it is quite dangers with these differences when porting
harald> applications).
Note that it's also for other ``blank like'' strings :
> sapply(c("", " ", "\t", "\n", "\r"), as.numeric)
\t \n \r
0 0 0 0 0
Without having the time currently to investigate your suggested change,
I tend to agree.
harald> Thanks for a wonderful program!
you're welcome!
harald> Harald Fekjær, Oslo, Norway
Martin Maechler <maechler@stat.math.ethz.ch> http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum LEO D10 Leonhardstr. 27
ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND
phone: x-41-1-632-3408 fax: ...-1228 <><
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._