Unlike measurements::conv_unit()
this function doesn't fail if it can't
convert a unit -- instead it outputs NA.
convert_units(x, from, to, quietly = FALSE)
x | a numeric vector giving the measurement value in its original units. |
---|---|
from | the unit in which the measurement was made. |
to | the unit to which the measurement is to be converted. |
quietly |
|
As in measurements::conv_unit()
if possible, or NA.
Other helpers: valid_units
#> [1] 0.01 NA#> [1] 0.01 NA#> Warning: Can't convert all units (inserting 1 missing values): #> the 'to' argument is not an acceptable unit.#> [1] 0.01 NA#> [1] 0.01 NA#> Warning: longer object length is not a multiple of shorter object length#> Warning: longer object length is not a multiple of shorter object length#> Warning: longer object length is not a multiple of shorter object length#> Warning: longer object length is not a multiple of shorter object length#> Warning: the condition has length > 1 and only the first element will be used#> Warning: the condition has length > 1 and only the first element will be used#> Warning: longer object length is not a multiple of shorter object length#> Warning: longer object length is not a multiple of shorter object length#> [1] 0.01 0.10