M
To: R help Mailing list mailto:r-help@r-project.org>>
Subject: [R] inadequacy in as.integer
[External Email]
Dear members,
I came across this queer thing during my analysis:
> as.integer("09098")
Any idea on how to retain the "0"?
i
Sent: Sunday, September 11, 2022 12:22 PM
To: R help Mailing list mailto:r-help@r-project.org>>
Subject: [R] inadequacy in as.integer
[External Email]
Dear members,
I came across this queer thing during my analysis:
> as.integer("09098")
9098
You seem to be confusing **what** is printed with *how* it is printed.
> print(9) ## a numeric (not an integer, actually. That would be 9L)
[1] 9 ## default print format
> print(formatC(9, width =2, flag = "0")) ## format specification
[1] "09"
> print(formatC(9, width =2, flag = "0"), quote = F
ct.org>
> Subject: RE: inadequacy in as.integer
>
> Keep as character.
>
> Tim
>
> -Original Message-
> From: R-help On Behalf Of akshay kulkarni
> Sent: Sunday, September 11, 2022 12:22 PM
> To: R help Mailing list
> Subject: [R] inadequacy in as.integer
On 9/11/22 12:22, akshay kulkarni wrote:
> Dear members,
> I came across this queer thing during my analysis:
>> as.integer("09098")
> 9098
>
> Any idea on how to retain the "0"?
Don't use as.integer(), which has performed precisely the service that
it advertises?
I certainly wouldn't call this
5 matches
Mail list logo