From macq at llnl.gov  Fri Nov 20 05:23:52 2009
From: macq at llnl.gov (Don MacQueen)
Date: Thu, 19 Nov 2009 20:23:52 -0800
Subject: [Rd] rounding the time: significant 0 does not appear (PR#14074)
In-Reply-To: <20091120024512.C9B7E282EF2D@mail.pubhealth.ku.dk>
References: <20091120024512.C9B7E282EF2D@mail.pubhealth.ku.dk>
Message-ID: <p06240804c72bc7e744ad@[192.168.11.5]>

This is not a bug, and has nothing to do with times. For example:

>  round(1.03,1)
[1] 1

Formatting is not the same as rounding. Perhaps you are assuming R 
formats numbers according to the concept of significant digits, but 
it doesn't. See the help page for the format function to get started 
with understanding R's rules for formatting numbers when it displays 
them. Maybe also some of the introductory R documents available on 
CRAN.

-Don


At 3:45 AM +0100 11/20/09, gus1201 at optimizelife.com wrote:
>Full_Name: Gustavo Lacerda
>Version: 2.9.1
>OS: Windows
>Submission from: (NULL) (137.82.157.97)
>
>
>I obtained 'time' by subtracting the results of two calls to sys.Time().
>
>
>>  round(time,0)
>Time difference of 1 mins
>>  round(time,1)
>Time difference of 1 mins
>>  round(time,2)
>Time difference of 1.03 mins
>>  round(time,3)
>Time difference of 1.032 mins
>
>
>Note that the second command above should return "1.0 mins", rather than "1
>min".
>
>______________________________________________
>R-devel at r-project.org mailing list
>https://*stat.ethz.ch/mailman/listinfo/r-devel


-- 
---------------------------------
Don MacQueen
Lawrence Livermore National Laboratory
Livermore, CA, USA
925-423-1062
macq at llnl.gov



[Rd] rounding the time: significant 0 does not appear (PR#14074)
Don MacQueen