| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/udunits.R |
| 3 |
\name{udunits2} |
| 4 |
\alias{udunits2} |
| 5 |
\alias{ud_are_convertible} |
| 6 |
\alias{ud_convert} |
| 7 |
\title{\pkg{udunits2} utilities} |
| 8 |
\usage{ |
| 9 |
ud_are_convertible(from, to, ...) |
| 10 |
|
| 11 |
ud_convert(x, from, to) |
| 12 |
} |
| 13 |
\arguments{ |
| 14 |
\item{from, to}{character vector or object of class \code{symbolic_units}, |
| 15 |
for the symbol(s) of the original unit(s) and the unit to convert to respectively.} |
| 16 |
|
| 17 |
\item{...}{unused.} |
| 18 |
|
| 19 |
\item{x}{numeric vector} |
| 20 |
} |
| 21 |
\value{ |
| 22 |
\code{ud_are_convertible} |
| 23 |
returns \code{TRUE} if both units exist and are convertible, |
| 24 |
\code{FALSE} otherwise. |
| 25 |
|
| 26 |
\code{ud_convert} |
| 27 |
returns a numeric vector with \code{x} converted to new unit. |
| 28 |
} |
| 29 |
\description{ |
| 30 |
Some \pkg{udunits2} utilities are exposed to the user. These functions are |
| 31 |
useful for checking whether units are convertible or converting between units |
| 32 |
without having to create \pkg{units} objects. |
| 33 |
Arguments are recycled if necessary. |
| 34 |
} |
| 35 |
\examples{ |
| 36 |
ud_are_convertible(c("m", "mm"), "km") |
| 37 |
ud_convert(c(100, 100000), c("m", "mm"), "km") |
| 38 |
|
| 39 |
a <- set_units(1:3, m/s) |
| 40 |
ud_are_convertible(units(a), "km/h") |
| 41 |
ud_convert(1:3, units(a), "km/h") |
| 42 |
|
| 43 |
ud_are_convertible("degF", "degC") |
| 44 |
ud_convert(32, "degF", "degC") |
| 45 |
} |