Description Usage Arguments Details See Also Examples

View source: R/user_conversion.R

Tells the `units`

package how to convert between units that
have a linear relationship, i.e. can be related on the form *y = α
x* (constant) or *y = α + x* (offset).

1 2 3 | ```
install_conversion_constant(from, to, const)
install_conversion_offset(from, to, const)
``` |

`from` |
String for the symbol of the unit being converted from. |

`to` |
String for the symbol of the unit being converted to. One of |

`const` |
The constant |

This function handles the very common case where units are related
through a linear function, that is, you can convert from one to the other
as *y = α x*. Using this function, you specify that you
can go from values of type `from`

to values of type `to`

by
multiplying by a constant, or adding a constant.

`install_symbolic_unit`

, `remove_symbolic_unit`

1 2 3 4 5 6 7 8 9 10 11 12 13 | ```
# one orange is worth two apples
install_symbolic_unit("orange")
install_conversion_constant("orange", "apple", 2) # apple = 2 * orange
apples <- 2 * as_units("apple")
oranges <- 1 * as_units("orange")
apples + oranges
oranges + apples
install_conversion_offset("meter", "newmeter", 1)
m = set_units(1:3, meter)
n = set_units(1:3, newmeter)
m + n
n + m
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.