recycle: Variable recycler

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Recycle the elements in x to make a vector that has length N.

Usage

1
recycle(x, N)

Arguments

x

A vector of length >= 1

N

The desired length of the result. Should be >= 2.

Details

Typical usages are:

1
2
 recycle(1:8, 17) recycle(c("red", "blue",
"green"), 7) 

If length(x) == 1 then this is equivalent to rep(x). N does not have to be an even number of multiples of length(x).

Value

A vector of length N, with elements made up by repeating x as many times as necessary.

Author(s)

Mark Cowley, 9 Nov 2005

See Also

rep

Examples

1
2
recycle(1:8, 17)
recycle(c("red", "blue", "green"), 7)

drmjc/mjcbase documentation built on May 15, 2019, 2:27 p.m.