Replicate Data Values

DESCRIPTION:

Replicates the input either a certain number of times or to a certain length.

USAGE:

rep(x, times=<<see below>>, length.out=<<see below>>, 
    each=<<see below>>, bigdata=F) 

REQUIRED ARGUMENTS:

x
vector or bdVector. Missing values ( NAs) are allowed.

At least one of times, length.out, and each must be given.

OPTIONAL ARGUMENTS:

times
how many times to replicate x. There are two ways to use times. If it is a single value, the whole of x is replicated that many times. If it is a vector or bdVector that is the same length as x, the result is a vector or bdVector with times[1] replications of x[1], times[2] of x[2], etc. Zero is allowed in both usages; if times=0, then the length of the result is 0. It is an error if the length of times is neither 1 nor the length of x.
length.out
the desired length of the result. This argument may be given instead of times, in which case x is replicated as much as needed to produce a result with length.out data values. If both times and length.out are given, times is ignored.
each
If each is supplied, each element of x is repeated each times. This vector or bdVector is repeated again if times or length.out is also given.
bigdata
a logical value. If TRUE, an object of type bdVector is returned. Otherwise, a vector object is returned. This argument can be used only if the bigdata library section has been loaded.

VALUE:

a vector or bdVector of the same mode as x with the data values in x replicated according to the arguments times, length.out, and each. Any names are removed.

DETAILS:

Missing values ( NAs) and Infs are treated just like other values.

SEE ALSO:

, .

EXAMPLES:

rep(0, 100)    # 100 zeros 
# 1, 2, 3, 4 repeated until there are 48 numbers  
rep(1:4, length.out=48)  
rep(1:10, 10)    # 10 repetitions of 1:10 
rep(1:10, 1:10)  # 1, 2, 2, 3, 3, 3, ... 
rep(1:5, each=2) # 1, 1, 2, 2, 3, 3, 4, 4, 5, 5 
rep(1:3, 5, each=2) # same as rep( c(1, 1, 2, 2, 3, 3), 5)