On Wed, Feb 08, 2012 at 03:12:56PM +0100, Arnaud Gaboury wrote:
> Hello,
>
> I have to deal with numbers with a decimal part as quarter, coming from two
> systems with different way to show decimals. I need to tell R these are in
> fact the same number.
>
> On one side my number are formatted t
] decimal number format as quarter
On Feb 8, 2012, at 15:48 , David Reiner wrote:
> Looks like something priced in eighths; we deal with similar notation for
> bonds and similar instruments.
>
>> x <- c(2.2, 2.4, 2.6, 3.2, 3.4, 3.6)
>> as.integer(x)+10*(x-as.integer(x)
On Wed, Feb 8, 2012 at 9:12 AM, Arnaud Gaboury wrote:
> Hello,
>
> I have to deal with numbers with a decimal part as quarter, coming from two
> systems with different way to show decimals. I need to tell R these are in
> fact the same number.
>
> On one side my number are formatted this way : 2
On Feb 8, 2012, at 15:48 , David Reiner wrote:
> Looks like something priced in eighths; we deal with similar notation for
> bonds and similar instruments.
>
>> x <- c(2.2, 2.4, 2.6, 3.2, 3.4, 3.6)
>> as.integer(x)+10*(x-as.integer(x))/8
> [1] 2.25 2.50 2.75 3.25 3.50 3.75
>
> Adjust the 10 an
-
From: David Reiner [mailto:david.rei...@xrtrading.com]
Sent: mercredi 8 février 2012 15:48
To: Arnaud Gaboury; jim holtman
Cc: r-help@r-project.org
Subject: RE: [R] decimal number format as quarter
Looks like something priced in eighths; we deal with similar notation for bonds
and similar
Message-
> From: jim holtman [mailto:jholt...@gmail.com]
> Sent: mercredi 8 février 2012 15:36
> To: Arnaud Gaboury
> Cc: r-help@r-project.org
> Subject: Re: [R] decimal number format as quarter
>
> will this do it for you:
>
>> x <- c(2.2, 2.4, 2.6, 3.2, 3.4
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Arnaud Gaboury
Sent: Wednesday, February 08, 2012 8:45 AM
To: jim holtman
Cc: r-help@r-project.org
Subject: Re: [R] decimal number format as quarter
TY Jim,
It do the trick.
I was tryin
On Feb 8, 2012, at 9:12 AM, Arnaud Gaboury wrote:
Hello,
I have to deal with numbers with a decimal part as quarter, coming
from two systems with different way to show decimals. I need to tell
R these are in fact the same number.
On one side my number are formatted this way : 2.2 , 2.4 a
Subject: Re: [R] decimal number format as quarter
will this do it for you:
> x <- c(2.2, 2.4, 2.6, 3.2, 3.4, 3.6)
> # get integer part
> x.i <- as.integer(x)
> # get fractional part
> x.f <- (x * 10) %% 10
> # new result
> result <- x.i + ifelse(x.f
will this do it for you:
> x <- c(2.2, 2.4, 2.6, 3.2, 3.4, 3.6)
> # get integer part
> x.i <- as.integer(x)
> # get fractional part
> x.f <- (x * 10) %% 10
> # new result
> result <- x.i + ifelse(x.f == 2
+ , .25
+ , ifelse(x.f == 4
+
Hello,
I have to deal with numbers with a decimal part as quarter, coming from two
systems with different way to show decimals. I need to tell R these are in fact
the same number.
On one side my number are formatted this way : 2.2 , 2.4 and 2.6. On the other
side, I have 2.25, 2.50 and 2.75.
A
11 matches
Mail list logo