Sets or retrieves the "units" attribute of an object.
For units.default replaces the builtin
version, which only works for time series objects. If the variable is
also given a label, subsetting (using [.labelled) will
retain the "units" attribute. For a Surv object,
units first looks for an overall "units" attribute, then
it looks for units for the time2 variable then for time1.
Usage
units(x, …)
# S3 method for default
units(x, none='', …)
# S3 method for Surv
units(x, none='', …)
# S3 method for default
units(x) <- value
Arguments
x
any object
…
ignored
value
the units of the object, or ""
none
value to which to set result if no appropriate attribute is
found
Value
the units attribute of x, if any; otherwise, the units attribute of
the tspar attribute of x if any; otherwise the value
none. Handling for Surv objects is different (see above).