EVOLUTION-MANAGER
Edit File: signif_half_up.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Round a numeric vector to the specified number of significant...</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for signif_half_up {janitor}"><tr><td>signif_half_up {janitor}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Round a numeric vector to the specified number of significant digits; halves will be rounded up.</h2> <h3>Description</h3> <p>In base R <code>signif()</code>, halves are rounded to even, e.g., <code>signif(11.5, 2)</code> and <code>signif(12.5, 2)</code> are both rounded to 12. This function rounds 12.5 to 13 (assuming <code>digits = 2</code>). Negative halves are rounded away from zero, e.g., <code>signif(-2.5, 1)</code> is rounded to -3. </p> <p>This may skew subsequent statistical analysis of the data, but may be desirable in certain contexts. This function is implemented from <a href="https://stackoverflow.com/a/1581007/">https://stackoverflow.com/a/1581007/</a>; see that question and comments for discussion of this issue. </p> <h3>Usage</h3> <pre> signif_half_up(x, digits = 6) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>a numeric vector to round.</p> </td></tr> <tr valign="top"><td><code>digits</code></td> <td> <p>integer indicating the number of significant digits to be used.</p> </td></tr> </table> <h3>Examples</h3> <pre> signif_half_up(12.5, 2) signif_half_up(1.125, 3) signif_half_up(-2.5, 1) # negatives get rounded away from zero </pre> <hr /><div style="text-align: center;">[Package <em>janitor</em> version 2.1.0 <a href="00Index.html">Index</a>]</div> </body></html>