On 28/03/2013 2:21 PM, Andras Farkas wrote:
Dear All,
wonder if you have a thought on the following: I am using the round(x,digits=3) command, but some of my values come out as: 0.07099999999999999 AND 0.06900000000000001. Any thoughts on why this maty be happening or how to eliminate the problem?
You are confusing rounding and string conversion. I imagine
0.07099999999999999
is what you get when you print 0.071 with 17 digits, because 0.071 can't
be represented exactly in the double precision floating point that R
uses. If you want to format it for display, then use format() (or
sprintf(), or one of the other formatting functions), don't use round().
Duncan Murdoch
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.