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.
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:
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