Related Articles

Related Articles

Get a List of Numbers in the Specified Range in R Programming – seq.int() Function
  • Last Updated : 25 Jun, 2020

seq.int() function in R Language is used to return a list of numbers in the specified range.

Syntax: seq.int(from, to, by)

Parameters:
from: specified range from
to: specified range to
by: specified number by which it jumps through returned number

Example 1:

filter_none

edit
close

play_arrow

link
brightness_4
code

# R program to illustrate
# seq.int function
  
# Calling seq.int() function
seq.int(0, 5)
seq.int(-2, 6)
seq.int(-3, 7)
seq.int(-7, 0)

chevron_right


Output:

[1] 0 1 2 3 4 5
[1] -2 -1  0  1  2  3  4  5  6
[1] -3 -2 -1  0  1  2  3  4  5  6  7
[1] -7 -6 -5 -4 -3 -2 -1  0

Example 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

# R program to illustrate
# seq.int function
  
# Calling seq.int() function
seq.int(2, 10, by = 2)
seq.int(0, 5, by = 1)
seq.int(5, 50, by = 10)

chevron_right


Output:

[1]  2  4  6  8 10
[1] 0 1 2 3 4 5
[1]  5 15 25 35 45
My Personal Notes arrow_drop_up
Recommended Articles
Page :