[R] Formatting numbers with a limited amount of digits consistently

From: Henrik Andersson <h.andersson_at_nioo.knaw.nl>
Date: Tue 31 May 2005 - 00:43:20 EST


I have tried to get signif, round and format to display numbers like these consistently in a table, using e.g. signif(x,digits=3)

17.01
18.15

I want

17.0
18.2

Not

17
18.2

Why is the last digit stripped off in the case when it is zero!

Is this a "feature" of R or did I miss something?



Henrik Andersson
Netherlands Institute of Ecology -
Centre for Estuarine and Marine Ecology
P.O. Box 140
4400 AC Yerseke
Phone: +31 113 577473
h.andersson@nioo.knaw.nl
http://www.nioo.knaw.nl/ppages/handersson

R-help@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 Received on Tue May 31 00:52:34 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:16 EST