Generating sequenced Vectors in R Programming – sequence() Function Last Updated : 15 Jun, 2020 Improve Improve Like Article Like Save Share Report sequence() function in R Language is used to create a vector of sequenced elements. It creates vectors with specified length, and specified differences between elements. It is similar to seq() function. Syntax: sequence(x) Parameters: x: Maximum element of vector Example 1: # R program to create sequence of vectors # Calling sequence() function sequence(4) sequence(6) sequence(c(4, 6)) Output: [1] 1 2 3 4 [1] 1 2 3 4 5 6 [1] 1 2 3 4 1 2 3 4 5 6 Example 2: # R program to create sequence of vectors # Calling sequence() function sequence(1:4) # Performing operations x <- 2 * sequence(4) x Output: [1] 1 1 2 1 2 3 1 2 3 4 [1] 2 4 6 8 Like Article Suggest improvement Previous Check for the Existence of a Vector Object in R Programming - is.vector() Function Next Combine Arguments into a Vector in R Programming - c() Function Share your thoughts in the comments Add Your Comment Please Login to comment...