An RObject is a SEXP (pointer) to an R object in memory. An RObject may be one of several different types. Note that in R, most objects are actually vectors, and scalars are just vectors of length 1.
RObject is a SelfInitializingType, and so it acts as its own constructor method. When passed a Macaulay2 object as input, the corresponding R object is returned.
Nothing inputs return R's NULL.
|
Boolean inputs return logical vectors.
|
Another logical vector without a Macaulay2 equivalent is NA.
|
ZZ inputs return integer vectors.
|
|
CC inputs return complex vectors.
|
|
|
With a List input, the type of the output depends on the elements of the list. The R function c is used to combine the elements into a vector.
|
|
|
|
|
When a Sequence is given as input, a pairlist, a linked list type used by R for function arguments, is returned.
|
When a List or Sequence is given as input and any of its elements are Option objects, then the keys are used as names by R.
|
|
When a Matrix is given as input, an R matrix is returned.
|
|
Each RObject is displayed by calling R's capture.output function.
The object RObject is a self initializing type, with ancestor classes voidstar < ForeignObject < HashTable < Thing.