Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

ud_are_convertible

Test if two units are convertible


Description

Parses and checks whether units can be converted by UDUNITS-2. Units may not be convertible either because they are different magnitudes or because one (or both) units are not defined in the database.

Usage

ud_are_convertible(x, y)

Arguments

x

character or object of class symbolic_units, for the symbol of the first unit.

y

character or object of class symbolic_units, for the symbol of the second unit.

Value

boolean, TRUE if both units exist and are convertible.

Examples

ud_are_convertible("m", "km")
a <- set_units(1:3, m/s)
ud_are_convertible(units(a), "km/h")
ud_are_convertible("s", "kg")

units

Measurement Units for R Vectors

v0.7-1
GPL-2
Authors
Edzer Pebesma [aut, cre] (<https://orcid.org/0000-0001-8049-7069>), Thomas Mailund [aut], Tomasz Kalinowski [aut], James Hiebert [ctb], Iñaki Ucar [aut] (<https://orcid.org/0000-0001-6403-5550>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.