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
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/udunits.R
\name{udunits2}
\alias{udunits2}
\alias{ud_are_convertible}
\alias{ud_convert}
\title{\pkg{udunits2} utilities}
\usage{
ud_are_convertible(from, to, ...)
ud_convert(x, from, to)
}
\arguments{
\item{from}{character or object of class \code{symbolic_units},
for the symbol of the original unit.}
\item{to}{character or object of class \code{symbolic_units},
for the symbol of the unit to convert.}
\item{...}{unused.}
\item{x}{numeric vector}
}
\value{
\code{ud_are_convertible}
returns \code{TRUE} if both units exist and are convertible,
\code{FALSE} otherwise.
\code{ud_convert}
returns a numeric vector with \code{x} converted to new unit.
}
\description{
Some \pkg{udunits2} utilities are exposed to the user. These functions are
useful for checking whether units are convertible or converting between units
without having to create \pkg{units} objects.
}
\examples{
ud_are_convertible("m", "km")
ud_convert(100, "m", "km")
a <- set_units(1:3, m/s)
ud_are_convertible(units(a), "km/h")
ud_convert(1:3, units(a), "km/h")
ud_are_convertible("degF", "degC")
ud_convert(32, "degF", "degC")
}
|