Table of Contents

R - rep (repetition of element)

Usage

rep(x, times = integer vector, length.out = non-negative integer, each = non-negative integer)
# default
rep(x, times = 1, length.out = NA, each = 1)

where:

Example

rep(1:4, 2)
[1] 1 2 3 4 1 2 3 4
 rep(letters[1:3], each = 10)
 [1] "a" "a" "a" "a" "a" "a" "a" "a" "a" "a" "b" "b" "b" "b" "b" "b" "b" "b" "b" "b" "c" "c"
[23] "c" "c" "c" "c" "c" "c" "c" "c"

Documentation / Reference

?rep