get_units: Gets the units as a string or strings.

Description Usage Arguments Value Examples

Description

Units can be acquired from objects of all types; types without units will return NA.

The exported, client-side method for acquiring an object's units in string representation.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
get_units(object, ...)

## S4 method for signature 'ANY'
get_units(object, ...)

## S4 method for signature 'unitbundle'
get_units(object, delimiter = "|",
  rule = c("disambiguate", "never", "always"), separator = " ", ...)

## S4 method for signature 'unitted'
get_units(object, ...)

## S4 method for signature 'unitted_list'
get_units(object, recursive = FALSE, ...)

## S4 method for signature 'list'
get_units(object, recursive = TRUE, ...)

## S4 method for signature 'data.frame'
get_units(object, recursive = TRUE, ...)

Arguments

object

The object from which to retrieve units

...

Other arguments passed on to the type-specific implementations

delimiter

A single-character string designating the delimiter that should surround those units that are to be delimited according to rule

rule

character string indicating the rule by which each unit within a unitdf will be delimited or not. The default, "disambiguate", wraps only those units that contain spaces or "^" characters. "never" wraps none, and "always" wraps all.

separator

character indicating a split among pieces of a unit, e.g., "mg L^-1" is separated by " ".

recursive

logical. If object is a list or data.frame, should the units attached to each element be returned?

Value

A string representing one set of units

Examples

1
2
get_units(5)
get_units(unitbundle("king kong"))

appling/unitted documentation built on May 10, 2019, 12:44 p.m.