Basic Examples (6)
NULL is transformed to RNull:
You can notice three things here: first, matrix data is stored in a one-dimensional list. Second, the matrix is converted to a column-major order, since this corresponds to how it is stored in R. Finally, matrix dimensions are stored in the "dim" attribute.
To perform the reverse operation and obtain a short form from the full internal form for a given expression representing some R object, you can use FromRForm:
The list, which is the value of the "myAtt" attribute for this object, was returned in a slightly different form. This is consistent with scalars being treated by R as one-element vectors, but can become a problem if you always rely on automatic type identification:
This problem and the recommended solution are discussed in more detail in the documentation page for RList.
Regardless of the way ToRForm interprets things, the cycle ToRForm to FromRForm should always return the same expression, except "dressing" scalars in extra lists.