stevensanderson, The
rep()
function allows you to efficiently repeat elements of a vector or a specified value. Its syntax is straightforward:rep(x, times, each)
. Thex
parameter represents the element to be repeated,times
determines the number of repetitions, andeach
(optional) specifies how many times each element should be repeated before moving to the next.