fnRound will round numeric values in accordance with PSMD policy. The policy (as at August 2016) proposes the use of the asymmetric round-half-up method (arithmetic rounding). This method rounds values at or above the midpoint away from zero and values below the midpoint towards zero to the closest required decimal place.
For example, when rounded to two decimal places values of 1.000 to 1.004 become 1.00 and values of 1.005 to 1.009 become 1.01. This applies irrespective of a number's sign so that values of -1.000 to -1.004 become -1.00 and values of -1.005 to -1.009 become -1.01.
Adapted from an anonymous post at Statistically Significant; http://alandgraf.blogspot.co.uk/2012/06/rounding-in-r.html
x is the numeric value or variable to be rounded
n is the number of decimal places required. Trailing zeroes will be excluded.
Dr Daniel Zahra, e:[email protected]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.