Site hosted by Angelfire.com: Build your free website today!

Creating Sequential objects :

> seq(1,10,2)               # [ initial value = 1, final value = 10, increment = 2]
[1] 1 3 5 7 9
> seq(100,10,-5)          # [ reversible sequence with –ve increment]
 [1] 100  95  90  85  80  75  70  65  60  55  50  45  40  35  30  25  20  15  10
> b<- 1:30                   # [considers all value from 1 to 30]
> b
 [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
> c<- 30:1
> c
 [1] 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10  9  8  7  6  5  4  3  2  1
> seq(0,2*pi,length=25) # [ specifies length of resulting vector]
 [1] 0.0000000 0.2617994 0.5235988 0.7853982 1.0471976 1.3089969 1.5707963 1.8325957 2.0943951 2.3561945
[11] 2.6179939 2.8797933 3.1415927 3.4033920 3.6651914 3.9269908 4.1887902 4.4505896 4.7123890 4.9741884
[21] 5.2359878 5.4977871 5.7595865 6.0213859 6.2831853

Back to Index page