Liaw, Andy wrote:
Looks very neat, Gabor!
I just cannot fathom why anyone who want to write numerics with those
separators in a flat file. That's usually not for human consumption,
and computers don't need those separators!
Andy
The world is stranger than you think...
(One of my
@stat.math.ethz.ch
Subject: Re: [R] thousand separator (was RE:
weight)
Bert,
What am I missing?
print(as.numeric(gsub(,, ,
1,123,456.789)), 10)
[1] 1123456.789
FWIW, this is using:
R version 2.5.0 Patched (2007-04-27 r41355)
Marc
On Mon, 2007
I've run into this occasionally. My current solution is simply to read
it into Excel, re-format the offending column(s) by unchecking the
thousand separator box, and write it back out. Not exactly ideal to
say the least. If anyone can provide a better solution in R, I'm all
ears...
Andy
One possibility would be to use something like the following
post-import:
WTPP
[1] 1,106.8250 1,336.5138
str(WTPP)
Factor w/ 2 levels 1,106.8250,1,336.5138: 1 2
as.numeric(gsub(,, , WTPP))
[1] 1106.825 1336.514
Essentially strip the ',' characters from the factors and then coerce
the
@stat.math.ethz.ch
Subject: Re: [R] thousand separator (was RE: weight)
One possibility would be to use something like the following
post-import:
WTPP
[1] 1,106.8250 1,336.5138
str(WTPP)
Factor w/ 2 levels 1,106.8250,1,336.5138: 1 2
as.numeric(gsub(,, , WTPP))
[1] 1106.825 1336.514
Essentially strip
Bert Gunter
Genentech Nonclinical Statistics
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Marc Schwartz
Sent: Monday, April 30, 2007 10:02 AM
To: Liaw, Andy
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] thousand separator (was RE: weight
Thank-you Andy!! That works great now
Nat
__
I've run into this occasionally. My current solution is simply to read
it into Excel, re-format the offending column(s) by unchecking the
thousand separator box, and write it back out. Not exactly ideal to
say the least. If
-help@stat.math.ethz.ch
Subject: Re: [R] thousand separator (was RE: weight)
Bert,
What am I missing?
print(as.numeric(gsub(,, , 1,123,456.789)), 10)
[1] 1123456.789
FWIW, this is using:
R version 2.5.0 Patched (2007-04-27 r41355)
Marc
On Mon, 2007-04-30 at 10:13 -0700, Bert Gunter wrote
Nonclinical Statistics
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Marc Schwartz
Sent: Monday, April 30, 2007 10:18 AM
To: Bert Gunter
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] thousand separator (was RE: weight)
Bert,
What am I
-help@stat.math.ethz.ch
Subject: Re: [R] thousand separator (was RE: weight)
Bert,
What am I missing?
print(as.numeric(gsub(,, , 1,123,456.789)), 10)
[1] 1123456.789
FWIW, this is using:
R version 2.5.0 Patched (2007-04-27 r41355)
Marc
On Mon, 2007-04-30 at 10:13 -0700
@stat.math.ethz.ch
Subject: Re: [R] thousand separator (was RE: weight)
Bert,
What am I missing?
print(as.numeric(gsub(,, , 1,123,456.789)), 10)
[1] 1123456.789
FWIW, this is using:
R version 2.5.0 Patched (2007-04-27 r41355)
Marc
On Mon, 2007-04-30
11 matches
Mail list logo