On 22/02/2010 9:06 AM, Oliver wrote:
Hello,

I need to have a "kaufmaennisches Runden" function.

Is there already something like that?

It means: rounding up the 5, instead of rounding it down.

So, 245.455 would give 245.46

I found no option for this.
Maybe there is a package for it?

This is a little tricky, because 245.455 is not a representable number in base R. If x is represented as x+epsilon, it will tend to round up, if it is x-epsilon, it will tend to round down. (I say tend to because R tries to do banker's rounding, and the math routines attempt to do exact calculations even when they are not really possible, so it is hard to predict exactly what will happen for a particular number.) There are packages for handling rational numbers that could handle it exactly; I don't know how flexible they are about rounding.

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.

Reply via email to