EVOLUTION-MANAGER
Edit File: drop_units.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: Drop Units</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 drop_units {units}"><tr><td>drop_units {units}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Drop Units</h2> <h3>Description</h3> <p>Drop units attribute and class. </p> <h3>Usage</h3> <pre> drop_units(x) ## S3 method for class 'units' drop_units(x) ## S3 method for class 'data.frame' drop_units(x) ## S3 method for class 'mixed_units' drop_units(x) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>an object with units metadata.</p> </td></tr> </table> <h3>Details</h3> <p>Equivalent to <code>units(x) <- NULL</code>, or the pipe-friendly version <code>set_units(x, NULL)</code>, but <code>drop_units</code> will fail if the object has no units metadata. Use the alternatives if you want this operation to succeed regardless of the object type. </p> <p>A <code>data.frame</code> method is also provided, which checks every column and drops units if any. </p> <h3>Value</h3> <p>the numeric without any units attributes, while preserving other attributes like dimensions or other classes. </p> <h3>Examples</h3> <pre> x <- 1 y <- set_units(x, m/s) # this succeeds drop_units(y) set_units(y, NULL) set_units(x, NULL) ## Not run: # this fails drop_units(x) ## End(Not run) df <- data.frame(x=x, y=y) df drop_units(df) </pre> <hr /><div style="text-align: center;">[Package <em>units</em> version 0.6-7 <a href="00Index.html">Index</a>]</div> </body></html>