# unitType: Return the Units of a Unit Object

Description Usage Arguments Value Author(s) See Also Examples

## Description

This function returns the units of a unit object.

## Usage

 `1` ```unitType(x, recurse = FALSE) ```

## Arguments

 `x` A unit object. `recurse` Whether to recurse into complex units.

## Value

For simple units, this will be just a vector of coordinate systems, like `"inches"` or `"npc"`.

More complex units that involve an operation on units return an operator, like `"sum"`, `"min"`, or `"max"`.

When `recurse = TRUE`, the result is always a list and more complex units generate sublists (see the Examples below).

## Author(s)

Thomas Lin Pedersen and Paul Murrell

`unit`

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21``` ```u <- unit(1:5, c("cm", "mm", "in", "pt", "null")) unitType(u) unitType(unit(1, "npc")) unitType(unit(1:3/4, "npc")) unitType(unit(1:3/4, "npc") + unit(1, "inches")) unitType(min(unit(0.5, "npc"), unit(1, "inches"))) unitType(unit.c(unit(0.5, "npc"), unit(2, "inches") + unit(1:3/4, "npc"), unit(1, "strwidth", "hi there"))) unitType(min(unit(1, "in"), unit(1, "npc") + unit(1, "mm"))) unitType(u, recurse=TRUE) unitType(unit(1, "npc"), recurse=TRUE) unitType(unit(1:3/4, "npc"), recurse=TRUE) unitType(unit(1:3/4, "npc") + unit(1, "inches"), recurse=TRUE) unitType(min(unit(0.5, "npc"), unit(1, "inches")), recurse=TRUE) unitType(unit.c(unit(0.5, "npc"), unit(2, "inches") + unit(1:3/4, "npc"), unit(1, "strwidth", "hi there")), recurse=TRUE) unitType(min(unit(1, "in"), unit(1, "npc") + unit(1, "mm")), recurse=TRUE) unlist(unitType(min(unit(1, "in"), unit(1, "npc") + unit(1, "mm")), recurse=TRUE)) ```