RLink`
RLink`

RObject

RObject[data,attributes]

represents a general R object, usually having a non-trivial set of attributes.

Details and Options

  • RObject is a container that allows you to specify attributes for a given R object.
  • data should be any valid short form of an expression representing an R object in RLink.
  • attributes must have the form RAttributes["name1":> value1,], where values of attributes can be any R objects handled by RLink.

Examples

Basic Examples  (4)

This constructs a list (vector) of random integers in R:

This makes a contingency table of the above data:

Since the corresponding R object (table) has non-trivial attributes, RObject was used to make it possible to include those.

This constructs an R data frame out of the contingency table:

Here is the full internal form RLink uses to represent the above data frame:

As you can see, RObject is now gone, since heads used in the RLink internal representation of R objects (RVector and RList) can accommodate attributes.

This creates a matrix:

Send it to R:

Assign another attribute to R's mat variable:

Get back a resulting R object:

Since now it has an attribute, RObject was used to represent it. You can also display its attributes:

Note that the "dim" attribute is implicit in the matrix representation in the short form, so its presence does not require the use of RObject. It is, however, explicitly present in the full form:

Wolfram Research (2012), RObject, Wolfram Language function, https://reference.wolfram.com/language/RLink/ref/RObject.html.

Text

Wolfram Research (2012), RObject, Wolfram Language function, https://reference.wolfram.com/language/RLink/ref/RObject.html.

CMS

Wolfram Language. 2012. "RObject." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/RLink/ref/RObject.html.

APA

Wolfram Language. (2012). RObject. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/RLink/ref/RObject.html

BibTeX

@misc{reference.wolfram_2024_robject, author="Wolfram Research", title="{RObject}", year="2012", howpublished="\url{https://reference.wolfram.com/language/RLink/ref/RObject.html}", note=[Accessed: 05-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_robject, organization={Wolfram Research}, title={RObject}, year={2012}, url={https://reference.wolfram.com/language/RLink/ref/RObject.html}, note=[Accessed: 05-December-2024 ]}