[R] Format wanted...

Duncan Murdoch murdoch.duncan at gmail.com
Sun Mar 25 01:30:29 CET 2012


Do we have a format that always includes a decimal point and a given 
number of significant digits, but otherwise drops unnecessary 
characters?  For example, if I wanted 5 digits, I'd want the following:

Round to 5 digits:
1.234567  -> "1.2346"

Drop unnecessary zeros:
1.23      -> "1.23"

Force inclusion of a decimal point:
1         -> "1."

Duncan Murdoch



More information about the R-help mailing list