Friday, 12 June 2015

R : Colon Operator (:)

‘:’ operator is used to generate Regular sequences.

Syntax
Variable <- from:to

> i <- 5:25
> i
 [1]  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
>
> i <- pi:6
> i
[1] 3.141593 4.141593 5.141593
>
> i <- pi:9
> i
[1] 3.141593 4.141593 5.141593 6.141593 7.141593 8.141593


Prevoius                                                 Next                                                 Home

No comments:

Post a Comment