rep_len() function in R Language is used to replicate a given value in the specified length.
Syntax: rep_len(x, length.out) Parameters: x: specified value length.out: specified number of items get printedExample 1:
# R program to illustrate
# rep_len function
# Calling the rep_len() function
rep_len(1:5, 5)
rep_len(1:5, 7)
rep_len(1:5, 10)
[1] 1 2 3 4 5 [1] 1 2 3 4 5 1 2 [1] 1 2 3 4 5 1 2 3 4 5Example 2:
# R program to illustrate
# rep_len function
# Calling the rep_len() function
rep_len(c(1, 2), 4)
rep_len(c(1, 2, 3), 5)
rep_len(c(5), 6)
[1] 1 2 1 2 [1] 1 2 3 1 2 [1] 5 5 5 5 5 5