[R] format a number

Martin Kaffanke technik at roomandspace.com
Mon Mar 10 12:18:27 CET 2008


Hi there!

I have i.e. v = c(0.43554, -0.22343), and so on.  Now I'd like to make a
format like

format(v, digits=2)  but without the leading 0, so 0.43554 becomes .44,
-0.22343 becomes -.22 

How can I do that?

runnable example for copy and paste:

v = c(0.43554, -0.22343)
format(v, digits=2)

Thanks,
Martin

-- 
Ihr Partner für Webdesign, Webapplikationen und Webspace.
http://www.roomandspace.com/
Martin Kaffanke +43 650 4514224
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : https://stat.ethz.ch/pipermail/r-help/attachments/20080310/551887ca/attachment.bin 


More information about the R-help mailing list