seq_len()
function in R Language is used to generate a sequence from 1 to the specified number.
Syntax: seq_len(x)
Parameters:
x: specified number
Example 1:
seq_len( 1 )
seq_len( 3 )
seq_len( 0 )
seq_len( 6 )
|
Output:
[1] 1
[1] 1 2 3
integer(0)
[1] 1 2 3 4 5 6
Example 2:
my_vector < - c( 5 , 6 , 1 , 13 , 7 )
seq_len(length(my_vector))
|
Output:
[1] 1 2 3 4 5
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!