[R] round() and negative digits
Carl Witthoft
carl at witthoft.com
Sun Oct 9 02:46:58 CEST 2011
On 10/8/11 6:11 PM, (Ted Harding) wrote:
> Carl Witthoft's serendipitous discovery is a nice example
> of how secrets can be guessed by wondering "what if ... ?".
> So probably you don;t need to tell the secrets.
>
> Taking the "negative digits" to their logical extreme:
>
> round(654.321,2)
> # [1] 654.32
> round(654.321,1)
> # [1] 654.3
> round(654.321,0)
> # [1] 654
> round(654.321,-1)
> # [1] 650
> round(654.321,-2)
> # [1] 700
> round(654.321,-3)
> # [1] 1000
> round(654.321,-4)
> # [1] 0
>
> which is what you'd logically expect (but is it what you
> would intuitively expect?).
>
Oh, oh, somebody's going all metaphysical on us.
--
-----
Sent from my Cray XK6
More information about the R-help
mailing list