Macaulay2 » Documentation
Packages » RInterface :: RObject : RObject
next | previous | forward | backward | up | index | toc

RObject : RObject -- R colon operator

Synopsis

Description

Generate the sequence between two numbers with step size 1 (or -1 if the first number is greater than the second). This operator is available both as :, as in R, or .., its Macaulay2 equivalent.

i1 : x = RObject 2

o1 = [1] 2

o1 : RObject of type integer
i2 : y = RObject 7

o2 = [1] 7

o2 : RObject of type integer
i3 : x:y

o3 = [1] 2 3 4 5 6 7

o3 : RObject of type integer
i4 : y:x

o4 = [1] 7 6 5 4 3 2

o4 : RObject of type integer
i5 : x..y

o5 = [1] 2 3 4 5 6 7

o5 : RObject of type integer

One of the operands may be a Macaulay2 object. It will be converted to an RObject before the operation is performed. An exception is that when using the : operator and the first argument given is a Macaulay2 ZZ object, ZZ : Thing will be called instead.

i6 : x:7

o6 = [1] 2 3 4 5 6 7

o6 : RObject of type integer
i7 : 2:y

o7 = ([1] 7, [1] 7)

o7 : Sequence
i8 : 2..y

o8 = [1] 2 3 4 5 6 7

o8 : RObject of type integer

Ways to use this method: