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.
Arguments
- x
Variable
- unit_def
Unit definition, e.g. u('seconds')
Value
Variable with new unit (only in Julia)
Examples
# 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'))"
)