RObject
RObject[data,attributes]
represents a general R object, usually having a non-trivial set of attributes.
更多信息和选项
- 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.
范例
基本范例 (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:
文本
Wolfram Research (2012),RObject,Wolfram 语言函数,https://reference.wolfram.com/language/RLink/ref/RObject.html.
CMS
Wolfram 语言. 2012. "RObject." Wolfram 语言与系统参考资料中心. Wolfram Research. https://reference.wolfram.com/language/RLink/ref/RObject.html.
APA
Wolfram 语言. (2012). RObject. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/RLink/ref/RObject.html 年