Macaulay2 » Documentation
Packages » RInterface » RObject » new RObject from List
next | previous | forward | backward | up | index | toc

new RObject from List -- create an R vector from a list

Description

Converts a Macaulay2 List to an R vector using R's c function. The type of the resulting vector is determined by the elements:

i1 : RObject {true, false, true, false}

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

o1 = TRUE, FALSE, TRUE, FALSE

o1 : RObject of type logical
i2 : RObject {2, 4, 6, 8, 10}

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

o2 = 2, 4, 6, 8, 10

o2 : RObject of type integer
i3 : RObject {0, 1/2, exp 1}

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

o3 = 0, 0.5, 2.71828182845905

o3 : RObject of type double
i4 : RObject apply(3, k -> exp(2*k*pi*ii/3))

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

o4 = 1+0i, -0.5+0.866025403784439i, -0.5-0.866025403784438i

o4 : RObject of type complex
i5 : RObject {"foo", "bar", "baz"}

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

o5 = foo, bar, baz

o5 : RObject of type character

When any elements are Option objects, the keys become names in R.

i6 : RObject {foo => 1, bar => 2}

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

o6 = 1, 2

o6 : RObject of type integer
i7 : RObject {foo => 1, 2, bar => 3}

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

o7 = 1, 2, 3

o7 : RObject of type integer

See also

Ways to use this method:


The source of this document is in RInterface/doc/objects.m2:328:0.