Convert units
Add units to convert function
Usage
# S4 method for class 'character'
convert(from, to, x = 1, database = "base", ...)
# S4 method for class 'numeric'
convert(x = 1, from, to, database = "base", ...)
# S4 method for class 'character,character,numeric'
add_to_convert(
type,
unit,
coef,
alias = "",
SI_prefixes = FALSE,
database = "base",
update = TRUE
)
Arguments
- from
character of length one with unit name
- to
character of length one with unit name
- x
numeric vector with data to convert
- database
character name of a database with units (`base` by default, other options are not implemented yet).
- ...
currently ignored
- type
character, type of the unit (one of "Energy", "Power", "Mass", "Time", "Length", "Area", "Pressure", "Density", "Volume", "Flow Rates", "Currency").
- unit
character, the name of the new unit to add to the `database`.
- coef
numeric, convert factor to the base unit of this type (see the first column of `convert_data[[database]][[type]]`).
- alias
character vector, alternative name(s) for the same unit.
- SI_prefixes
logical, can be used with `SI` prefixes, FALSE by default.