> 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:[EMAIL PROTECTED] Sent: Monday, February 28, 2005 2:43 PM To: [email protected] 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: [EMAIL PROTECTED] ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
