File: Ops.units.Rd

package info (click to toggle)
r-cran-units 0.8-1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,068 kB
  • sloc: xml: 2,437; cpp: 175; sh: 13; makefile: 2
file content (49 lines) | stat: -rw-r--r-- 1,464 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/arith.R
\name{Ops.units}
\alias{Ops.units}
\title{S3 Ops Group Generic Functions for units objects}
\usage{
\method{Ops}{units}(e1, e2)
}
\arguments{
\item{e1}{object of class \code{units},
or something that can be coerced to it by \code{as_units(e1)}}

\item{e2}{object of class \code{units},
or something that can be coerced to it by \code{as_units(e2)},
or in case of power a number (integer n or 1/n)}
}
\value{
object of class \code{units}
}
\description{
Ops functions for units objects, including comparison, product and divide,
add, subtract.
}
\details{
Users are advised against performing arithmetical operations with
temperatures in different units. The \pkg{units} package ensure that results
1) are arithmetically correct, and 2) satisfy dimensional analysis, but could
never ensure that results are physically meaningful. Temperature units are
special because there is an absolute unit, Kelvin, and relative ones, Celsius
and Fahrenheit degrees. Arithmetic operations between them are meaningless
from the physical standpoint. Users are thus advised to convert all
temperatures to Kelvin before operating.
}
\examples{
a <- set_units(1:3, m/s)
b <- set_units(1:3, m/s)
a + b
a * b
a / b
a <- as_units("kg m-3")
b <- set_units(1, kg/m/m/m)
a + b
a = set_units(1:5, m)
a \%/\% a
a \%/\% set_units(2)
set_units(1:5, m^2) \%/\% set_units(2, m)
a \%\% a
a \%\% set_units(2)
}