EVOLUTION-MANAGER
Edit File: Math.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: Mathematical operations for units objects</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 Math.units {units}"><tr><td>Math.units {units}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Mathematical operations for units objects</h2> <h3>Description</h3> <p>Mathematical operations for units objects </p> <h3>Usage</h3> <pre> ## S3 method for class 'units' Math(x, ...) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>object of class units</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>parameters passed on to the Math functions</p> </td></tr> </table> <h3>Details</h3> <p>Logarithms receive a special treatment by the underlying <span class="pkg">udunits2</span> library. If a natural logarithm is applied to some <code>unit</code>, the result is <code>ln(re 1 unit)</code>, which means <em>natural logarithm referenced to <code>1 unit</code></em>. For base 2 and base 10 logarithms, the output <code>lb(...)</code> and <code>lg(...)</code> respectively instead of <code>ln(...)</code>. </p> <p>This is particularly important for some units that are typically expressed in a logarithmic scale (i.e., <em>bels</em>, or, more commonly, <em>decibels</em>), such as Watts or Volts. For some of these units, the default <span class="pkg">udunits2</span> database contains aliases: e.g., <code>BW</code> (bel-Watts) is an alias of <code>lg(re 1 W)</code>; <code>Bm</code> (bel-milliWatts) is an alias of <code>lg(re 0.001 W)</code>; <code>BV</code> is an alias of <code>lg(re 1 V)</code> (bel-Volts), and so on and so forth (see the output of <code>valid_udunits()</code> for further reference). </p> <p>Additionally, the <span class="pkg">units</span> package defines <code>B</code>, the <em>bel</em>, by default (because it is not defined by <span class="pkg">udunits2</span>) as an alias of <code>lg(re 1)</code>, unless a user-provided XML database already contains a definition of <code>B</code>, or the <code>define_bel</code> option is set to <code>FALSE</code> (see <code>help(units_options)</code>). </p> <h3>Examples</h3> <pre> # roundings, cummulative functions x <- set_units(sqrt(1:10), m/s) signif(x, 2) cumsum(x) # trigonometry sin(x) # not meaningful x <- set_units(sqrt(1:10), rad) sin(x) cos(x) x <- set_units(seq(0, 1, 0.1), 1) asin(x) acos(x) # logarithms x <- set_units(sqrt(1:10), W) log(x) # base exp(1) log(x, base = 3) log2(x) log10(x) set_units(x, dBW) # decibel-watts set_units(x, dBm) # decibel-milliwatts </pre> <hr /><div style="text-align: center;">[Package <em>units</em> version 0.6-7 <a href="00Index.html">Index</a>]</div> </body></html>