rep.int() function in R Language is used to replicate a given value into a specified number of times.
Syntax: rep.int(x, times) Parameters: x: specified value times: specified number of times the value get printedExample 1:
# R program to illustrate
# rep.int function
# Calling the rep.int() function
rep.int(1:2, 2)
rep.int(1:3, 1)
rep.int(0:1, 4)
[1] 1 2 1 2 [1] 1 2 3 [1] 0 1 0 1 0 1 0 1Example 2:
# R program to illustrate
# rep.int function
# Calling the rep.int() function
rep.int(c(1, 2), 2)
rep.int(c(1, 2, 3), 3)
rep.int(c(5), 6)
[1] 1 2 1 2 [1] 1 2 3 1 2 3 1 2 3 [1] 5 5 5 5 5 5