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

new RObject from Matrix -- create an R matrix from a Macaulay2 matrix

Description

Converts a Macaulay2 Matrix to an R matrix. Since Macaulay2 uses row-major order and R uses column-major order, the matrix is transposed during conversion so that the displayed values match.

i1 : A = random(ZZ^2, ZZ^3)

o1 = | 8 3 8 |
     | 1 7 3 |

              2       3
o1 : Matrix ZZ  <-- ZZ
i2 : RObject A

o2 =      [,1] [,2] [,3]
     [1,]    8    3    8
     [2,]    1    7    3

o2 : RObject of type integer

Note that value(RObject) does not undo this transposition, so value and RObject are not exact inverses when applied to matrices.

i3 : value oo

o3 = {{8, 1}, {3, 7}, {8, 3}}

o3 : List
i4 : A == transpose matrix oo

o4 = true

See also

Ways to use this method:


The source of this document is in /build/reproducible-path/macaulay2-1.26.05+ds/M2/Macaulay2/packages/RInterface/doc/objects.m2:404:0.