Last data update: 2014.03.03

R: Replicate Elements of Unit Objects
unit.repR Documentation

Replicate Elements of Unit Objects

Description

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

This function has been deprecated in favour of a unit method for the generic rep function.

Usage

unit.rep(x, ...)

Arguments

x

An object of class "unit".

...

arguments to be passed to rep such as times and length.out.

Value

An object of class "unit".

Author(s)

Paul Murrell

See Also

rep

Examples

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

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(grid)
> png(filename="/home/ddbj/snapshot/RGM3/R_rel/result/grid/unit.rep.Rd_%03d_medium.png", width=480, height=480)
> ### Name: unit.rep
> ### Title: Replicate Elements of Unit Objects
> ### Aliases: unit.rep
> ### Keywords: dplot
> 
> ### ** Examples
> 
> rep(unit(1:3, "npc"), 3)
[1] 1npc 2npc 3npc 1npc 2npc 3npc 1npc 2npc 3npc
> rep(unit(1:3, "npc"), 1:3)
[1] 1npc 2npc 2npc 3npc 3npc 3npc
> rep(unit(1:3, "npc") + unit(1, "inches"), 3)
[1] 1npc+1inches 2npc+1inches 3npc+1inches 1npc+1inches 2npc+1inches
[6] 3npc+1inches 1npc+1inches 2npc+1inches 3npc+1inches
> rep(max(unit(1:3, "npc") + unit(1, "inches")), 3)
[1] max(1npc+1inches, 2npc+1inches, 3npc+1inches)
[2] max(1npc+1inches, 2npc+1inches, 3npc+1inches)
[3] max(1npc+1inches, 2npc+1inches, 3npc+1inches)
> rep(max(unit(1:3, "npc") + unit(1, "strwidth", "a"))*4, 3)
[1] 4*max(1npc+1strwidth, 2npc+1strwidth, 3npc+1strwidth)
[2] 4*max(1npc+1strwidth, 2npc+1strwidth, 3npc+1strwidth)
[3] 4*max(1npc+1strwidth, 2npc+1strwidth, 3npc+1strwidth)
> rep(unit(1:3, "npc") + unit(1, "strwidth", "a")*4, 3)
[1] 1npc+4*1strwidth 2npc+4*1strwidth 3npc+4*1strwidth 1npc+4*1strwidth
[5] 2npc+4*1strwidth 3npc+4*1strwidth 1npc+4*1strwidth 2npc+4*1strwidth
[9] 3npc+4*1strwidth
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>