unit.rep {grid}R Documentation

Replicate Elements of Unit Objects

Description

Replicates the units according to the values given in times and length.out.

Usage

unit.rep(x, times, length.out)

Arguments

x An object of class "unit".
times integer. A vector giving the number of times to repeat each element. Either of length 1 or length(x).
length.out integer. (Optional.) The desired length of the output vector.

Value

An object of class "unit".

Author(s)

Paul Murrell

See Also

rep

Examples

unit.rep(unit(1:3, "npc"), 3)
unit.rep(unit(1:3, "npc"), 1:3)
unit.rep(unit(1:3, "npc") + unit(1, "inches"), 3)
unit.rep(max(unit(1:3, "npc") + unit(1, "inches")), 3)
unit.rep(max(unit(1:3, "npc") + unit(1, "strwidth", "a"))*4, 3)
unit.rep(unit(1:3, "npc") + unit(1, "strwidth", "a")*4, 3)

[Package grid version 2.2.1 Index]