magclass (version 4.107.0)

set_magpie_units: set_magpie_units (!experimental!)

Description

A pipe-friendly version of units<-.magpie. Extension of set_units from the units package to MAgPIE objects.

Usage

set_magpie_units(x, value, manual_overwrite = FALSE)

Arguments

x

MAgPIE object

value

object of class units, a character of length one coercible to units via as_units, or a MAgPIE object

manual_overwrite

boolean indicating whether to coerce the object into the provided unit. If FALSE (default), value must be convertible from x's original unit (or else an error will be thrown), and the data in x will be converted to the new unit if possible. If TRUE, value will replace the existing unit without altering the data.

Value

MAgPIE object x converted to given unit (if possible)

See Also

set_units