Explain with example how to create sequence using R.

871    Asked by LiamSMITH in Data Science , Asked on Dec 10, 2019
Answered by Liam SMITH

To create sequence of vectors or simply numbers, we use seq() function such as

seq(0,20)

It will create a sequence of numbers from 0 to 20 such as

[1] 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

[21] 20

We can also set a step size of desired number such as

seq(0,20,3) will create the following sequence

[1] 0 3 6 9 12 15 18



Your Answer

Interviews

Parent Categories