gus1201 at optimizelife.com
2009-Nov-20 02:45 UTC
[Rd] rounding the time: significant 0 does not appear (PR#14074)
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".
Don MacQueen
2009-Nov-20 04:23 UTC
[Rd] rounding the time: significant 0 does not appear (PR#14074)
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