Debian Codegraph @

man/Ops.units.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/arith.R
3 \name{Ops.units}
4 \alias{Ops.units}
5 \title{S3 Ops Group Generic Functions for units objects}
6 \usage{
7 \method{Ops}{units}(e1, e2)
8 }
9 \arguments{
10 \item{e1}{object of class \code{units},
11 or something that can be coerced to it by \code{as_units(e1)}}
12
13 \item{e2}{object of class \code{units},
14 or something that can be coerced to it by \code{as_units(e2)},
15 or in case of power a number (integer n or 1/n)}
16 }
17 \value{
18 object of class \code{units}
19 }
20 \description{
21 Ops functions for units objects, including comparison, product and divide,
22 add, subtract.
23 }
24 \details{
25 Users are advised against performing arithmetical operations with
26 temperatures in different units. The \pkg{units} package ensure that results
27 1) are arithmetically correct, and 2) satisfy dimensional analysis, but could
28 never ensure that results are physically meaningful. Temperature units are
29 special because there is an absolute unit, Kelvin, and relative ones, Celsius
30 and Fahrenheit degrees. Arithmetic operations between them are meaningless
31 from the physical standpoint. Users are thus advised to convert all
32 temperatures to Kelvin before operating.
33 }
34 \examples{
35 a <- set_units(1:3, m/s)
36 b <- set_units(1:3, m/s)
37 a + b
38 a * b
39 a / b
40 a <- as_units("kg m-3")
41 b <- set_units(1, kg/m/m/m)
42 a + b
43 a = set_units(1:5, m)
44 a \%/\% a
45 a \%/\% set_units(2)
46 set_units(1:5, m^2) \%/\% set_units(2, m)
47 a \%\% a
48 a \%\% set_units(2)
49 }