Test Whether it is an Absolute Unit

is_abs_unit(u)

Arguments

u

A unit object.

Details

Besides the normal absolute units (e.g. "mm", "inches"), this function simply assumes grob objects as absolute units.

For a complex unit which is combination of different units, it is absolute only if all units included are absolute units.

Value

A logical value.

Examples

is_abs_unit(unit(1, "mm"))
#> [1] TRUE
is_abs_unit(unit(1, "npc"))
#> [1] FALSE
is_abs_unit(textGrob("foo"))
#> [1] FALSE
is_abs_unit(unit(1, "mm") + unit(1, "npc"))
#> [1] FALSE