EVOLUTION-MANAGER
Edit File: oob.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: Out of bounds handling</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 oob {scales}"><tr><td>oob {scales}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Out of bounds handling</h2> <h3>Description</h3> <p>This set of functions modify data values outside a given range. The <code style="white-space: pre;">oob_*()</code> functions are designed to be passed as the <code>oob</code> argument of ggplot2 continuous and binned scales, with <code>oob_discard</code> being an exception. </p> <p>These functions affect out of bounds values in the following ways: </p> <ul> <li> <p><code>oob_censor()</code> replaces out of bounds values with <code>NA</code>s. This is the default <code>oob</code> argument for continuous scales. </p> </li> <li> <p><code>oob_censor_any()</code> acts like <code>oob_censor()</code>, but also replaces infinite values with <code>NA</code>s. </p> </li> <li> <p><code>oob_squish()</code> replaces out of bounds values with the nearest limit. This is the default <code>oob</code> argument for binned scales. </p> </li> <li> <p><code>oob_squish_any()</code> acts like <code>oob_squish()</code>, but also replaces infinite values with the nearest limit. </p> </li> <li> <p><code>oob_squish_infinite()</code> only replaces infinite values by the nearest limit. </p> </li> <li> <p><code>oob_keep()</code> does not adjust out of bounds values. In position scales, behaves as zooming limits without data removal. </p> </li> <li> <p><code>oob_discard()</code> removes out of bounds values from the input. Not suitable for ggplot2 scales. </p> </li></ul> <h3>Usage</h3> <pre> oob_censor(x, range = c(0, 1), only.finite = TRUE) oob_censor_any(x, range = c(0, 1)) oob_discard(x, range = c(0, 1)) oob_squish(x, range = c(0, 1), only.finite = TRUE) oob_squish_any(x, range = c(0, 1)) oob_squish_infinite(x, range = c(0, 1)) oob_keep(x, range = c(0, 1)) censor(x, range = c(0, 1), only.finite = TRUE) discard(x, range = c(0, 1)) squish(x, range = c(0, 1), only.finite = TRUE) squish_infinite(x, range = c(0, 1)) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>A numeric vector of values to modify.</p> </td></tr> <tr valign="top"><td><code>range</code></td> <td> <p>A numeric vector of length two giving the minimum and maximum limit of the desired output range respectively.</p> </td></tr> <tr valign="top"><td><code>only.finite</code></td> <td> <p>A logical of length one. When <code>TRUE</code>, only finite values are altered. When <code>FALSE</code>, also infinite values are altered.</p> </td></tr> </table> <h3>Details</h3> <p>The <code>oob_censor_any()</code> and <code>oob_squish_any()</code> functions are the same as <code>oob_censor()</code> and <code>oob_squish()</code> with the <code>only.finite</code> argument set to <code>FALSE</code>. </p> <p>Replacing position values with <code>NA</code>s, as <code>oob_censor()</code> does, will typically lead to removal of those datapoints in ggplot. </p> <p>Setting ggplot coordinate limits is equivalent to using <code>oob_keep()</code> in position scales. </p> <h3>Value</h3> <p>Most <code>oob_()</code> functions return a vector of numerical values of the same length as the <code>x</code> argument, wherein out of bounds values have been modified. Only <code>oob_discard()</code> returns a vector of less than or of equal length to the <code>x</code> argument. </p> <h3>Old interface</h3> <p><code>censor()</code>, <code>squish()</code>, <code>squish_infinite()</code> and <code>discard()</code> are no longer recommended; please use <code>oob_censor()</code>, <code>oob_squish()</code>, <code>oob_squish_infinite()</code> and <code>oob_discard()</code> instead. </p> <h3>Author(s)</h3> <p><code>oob_squish()</code>: Homer Strong <a href="mailto:homer.strong@gmail.com">homer.strong@gmail.com</a> </p> <h3>Examples</h3> <pre> # Censoring replaces out of bounds values with NAs oob_censor(c(-Inf, -1, 0.5, 1, 2, NA, Inf)) oob_censor_any(c(-Inf, -1, 0.5, 1, 2, NA, Inf)) # Squishing replaces out of bounds values with the nearest range limit oob_squish(c(-Inf, -1, 0.5, 1, 2, NA, Inf)) oob_squish_any(c(-Inf, -1, 0.5, 1, 2, NA, Inf)) oob_squish_infinite(c(-Inf, -1, 0.5, 1, 2, NA, Inf)) # Keeping does not alter values oob_keep(c(-Inf, -1, 0.5, 1, 2, NA, Inf)) # Discarding will remove out of bounds values oob_discard(c(-Inf, -1, 0.5, 1, 2, NA, Inf)) </pre> <hr /><div style="text-align: center;">[Package <em>scales</em> version 1.1.1 <a href="00Index.html">Index</a>]</div> </body></html>