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

RObject : RObject -- R colon operator

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

--error or time limit reached in conversion of output to net: type 'debugError()' to run it again; will try conversion to string

o1 = 2

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

--error or time limit reached in conversion of output to net: type 'debugError()' to run it again; will try conversion to string

o2 = 7

o2 : RObject of type integer
i3 : x:y

--error or time limit reached in conversion of output to net: type 'debugError()' to run it again; will try conversion to string

o3 = 2, 3, 4, 5, 6, 7

o3 : RObject of type integer
i4 : y:x

--error or time limit reached in conversion of output to net: type 'debugError()' to run it again; will try conversion to string

o4 = 7, 6, 5, 4, 3, 2

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

--error or time limit reached in conversion of output to net: type 'debugError()' to run it again; will try conversion to string

o5 = 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

--error or time limit reached in conversion of output to net: type 'debugError()' to run it again; will try conversion to string

o6 = 2, 3, 4, 5, 6, 7

o6 : RObject of type integer
i7 : 2:y

--error or time limit reached in conversion of output to net: type 'debugError()' to run it again; will try conversion to string

o7 = (7,7)

o7 : Sequence
i8 : 2..y

--error or time limit reached in conversion of output to net: type 'debugError()' to run it again; will try conversion to string

o8 = 2, 3, 4, 5, 6, 7

o8 : RObject of type integer

See also

Ways to use this method:


The source of this document is in RInterface/doc/arithmetic.m2:284:0.