[R] round() and negative digits

Duncan Murdoch murdoch.duncan at gmail.com
Sat Oct 8 13:18:10 CEST 2011

On 11-10-07 5:26 PM, Carl Witthoft wrote:
> Just wondering here -- I tested and found to my delight that
> %  round(325.4,-2)
> [1] 300
> gave me exactly what I would have expected (and wanted).  Since it's not
> explicitly mentioned in the documentation that negative 'digits' is
> allowed, I just wanted to ask whether this behavior is intentional or a
> happy turn of events.  I'm always paranoid that something not explicitly
> documented might disappear in future revisons.

It is intentional, and one of the regression tests confirms that it's 
there, so it won't disappear by mistake, and would be very unlikely to 
disappear intentionally.

Duncan Murdoch

More information about the R-help mailing list