File: keep_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 (33 lines) | stat: -rw-r--r-- 801 bytes parent folder | download
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
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/helpers.R
\name{keep_units}
\alias{keep_units}
\title{Apply a function keeping units}
\usage{
keep_units(FUN, x, ..., unit = units(x))
}
\arguments{
\item{FUN}{the function to be applied.}

\item{x}{first argument of \code{FUN}, of class \code{units}.}

\item{...}{optional arguments to \code{FUN}.}

\item{unit}{symbolic unit to restore after \code{FUN}.}
}
\value{
An object of class \code{units}.
}
\description{
Helper function to apply a function to a \code{units} object and then restore
the original units.
}
\details{
Provided for incompatible functions that do not preserve units. The user is
responsible for ensuring the correctness of the output.
}
\examples{
x <- set_units(1:5, m)
keep_units(drop_units, x)

}