Learn R Programming

units (version 0.8-5)

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)

Value

boolean, TRUE if both units exist and are convertible.

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.

Examples

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

Run the code above in your browser using DataLab