[R] number formatting
McGehee, Robert
Robert.McGehee at geodecapital.com
Mon Feb 28 20:50:56 CET 2005
> x <- .001
> x
[1] 0.001
> sub("+0", "", x)
[1] ".001"
Of course, that means you'll be storing this number as a character, but
if you're looking to format how the number is printed, that's probably
what you want.
-----Original Message-----
From: Laura Holt [mailto:lauraholt_983 at hotmail.com]
Sent: Monday, February 28, 2005 2:43 PM
To: r-help at stat.math.ethz.ch
Subject: [R] number formatting
Dear R People:
I have used the command round(x,3) to produce values with 3 places to
the
right of the decimal.
Is there any command to remove the leading zero before the decimal
point,
please: that is, if I have 0.375, how do I produce just .375, please?
Thanks in advance
R 2.0.1 for Windows
Sincerely,
Laura Holt
mailto: lauraholt_983 at hotmail.com
______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
More information about the R-help
mailing list