EVOLUTION-MANAGER
Edit File: extendrange.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: Extend a Numerical Range by a Small Percentage</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 extendrange {grDevices}"><tr><td>extendrange {grDevices}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Extend a Numerical Range by a Small Percentage</h2> <h3>Description</h3> <p>Extends a numerical range by a small percentage, i.e., fraction, <em>on both sides</em>. </p> <h3>Usage</h3> <pre> extendrange(x, r = range(x, na.rm = TRUE), f = 0.05) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>numeric vector; not used if <code>r</code> is specified.</p> </td></tr> <tr valign="top"><td><code>r</code></td> <td> <p>numeric vector of length 2; defaults to the <code><a href="../../base/html/range.html">range</a></code> of <code>x</code>.</p> </td></tr> <tr valign="top"><td><code>f</code></td> <td> <p>positive number(s) specifying the fraction by which the range should be extended. If longer than one, <code>f[1]</code> is used on the left, and <code>f[2]</code> on the right.</p> </td></tr> </table> <h3>Value</h3> <p>A numeric vector of length 2, <code>r + c(-f1,f2) * diff(r)</code>, where f1 is <code>f[1]</code> and f2 is <code>f[2]</code> or <code>f</code> if it is of length one. </p> <h3>See Also</h3> <p><code><a href="../../base/html/range.html">range</a></code>; <code><a href="../../base/html/pretty.html">pretty</a></code> which can be considered a sophisticated extension of <code>extendrange</code>. </p> <h3>Examples</h3> <pre> x <- 1:5 (r <- range(x)) # 1 5 extendrange(x) # 0.8 5.2 extendrange(x, f= 0.01) # 0.96 5.04 ## extend more to the right: extendrange(x, f=c(.01,.03)) # 0.96 5.12 ## Use 'r' if you have it already: stopifnot(identical(extendrange(r = r), extendrange(x))) </pre> <hr /><div style="text-align: center;">[Package <em>grDevices</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>