Replicating a Value to the Specified Length in R Programming – rep_len() Function Last Updated : 24 Jun, 2020 Improve Improve Like Article Like Save Share Report 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 printed Example 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) Output: [1] 1 2 3 4 5 [1] 1 2 3 4 5 1 2 [1] 1 2 3 4 5 1 2 3 4 5 Example 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) Output: [1] 1 2 1 2 [1] 1 2 3 1 2 [1] 5 5 5 5 5 5 Like Article Suggest improvement Previous Check for the Existence of a Vector Object in R Programming - is.vector() Function Next Plot Arrows Between Points in a Graph in R Programming - arrows() Function Share your thoughts in the comments Add Your Comment Please Login to comment...