| convert_u | R Documentation |
In rare cases, it may be desirable to change the units of a variable within an equation. Use convert_u() to convert a variable to another matching unit. See u() for more information on the rules of specifying units. Note that units are only supported in Julia, not in R.
convert_u(x, unit_def)
x |
Variable |
unit_def |
Unit definition, e.g. u('seconds') |
Variable with new unit (only in Julia)
model_units(), unit_prefixes(), u(), drop_u()
# Change the unit of rate from minutes to hours
sfm <- xmile() |>
build("rate", "constant", eqn = "10", units = "minutes") |>
build("change", "flow",
eqn = "(room_temperature - coffee_temperature) / convert_u(rate, u('hour'))"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.