unitType {grid} | R Documentation |
This function returns the units of a unit object.
unitType(x, recurse = FALSE)
x |
A unit object. |
recurse |
Whether to recurse into complex units. |
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).
Thomas Lin Pedersen and Paul Murrell
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))