rep(x, times=<<see below>>, length.out=<<see below>>,
each=<<see below>>, bigdata=F)
bdVector.
Missing values (
NAs) are allowed.
times,
length.out, and
each must be given.
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.
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 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.
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.
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.
Missing values (
NAs) and
Infs are treated just like other values.
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)