rounded | R Documentation |
Rounds positive numbers to integers (i.e., zero decimal places).
rounded(x)
x |
A numeric vector |
The base R round function "rounds to even" when rounding off a 5 (e.g., 0.5 rounds to 0 and 1.5 rounds to 2). To ensure that 0.5 is rounded up,
rounded
adds 0.5 to the input and truncates. Note that this function only works for positive numbers.
rounded(.5 + 0:4) # 1 2 3 4 5 ## different from IEEE / IEC rounding: 0 2 2 4 4
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.