units | R Documentation |
Set or retrieve measurement units to/from numeric vectors and convert units
(extensions to the units package for quantities
and
errors
objects).
## S3 replacement method for class 'quantities'
units(x) <- value
## S3 replacement method for class 'errors'
units(x) <- value
## S3 method for class 'errors'
set_units(x, value, ...,
mode = units_options("set_units_mode"))
## S3 method for class 'quantities'
mixed_units(x, values, ...)
## S3 method for class 'errors'
mixed_units(x, values, ...)
x |
a numeric object, or object of class |
value |
object of class |
... |
passed on to other methods. |
mode |
if |
values |
character vector with units encodings, or list with symbolic units of class |
For objects of class quantities
, methods `units<-`()
and set_units()
automatically convert the associated uncertainty to
the new unit (see examples below).
units
, set_units
.
(x <- set_quantities(1:5, m, 0.01))
set_units(x, cm)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.