RCode
RCode[code]
a container used by RLink to represent pieces of R code corresponding to R objects not directly supported by RLink.
Details and Options
- The code parameter is a string of R code which, when parsed and evaluated, would normally (but not always) produce an object in R workspace equivalent to the one represented by this code. This string is obtained by applying an R deparse function to the original R object being imported in the Wolfram Language.
- RLink does not guarantee that all objects imported into a Wolfram System session and represented by RCode[code] will result in identical objects created in R workspace if exported back into R (from the Wolfram Language). Therefore, generally RCode provides a form of representation for such objects, but not a form of equivalence.
- RLink does not guarantee that larger objects containing elements represented by RCode will be correctly exported from the Wolfram Language to R.
- Expressions with an RCode head transform trivially (are left unchanged) by the functions ToRForm and FromRForm.
Examples
Basic Examples (1)Summary of the most common use cases

https://wolfram.com/xid/0rrp6ajb22kk8-h8fcah
This creates a simple linear model:

https://wolfram.com/xid/0rrp6ajb22kk8-eos116
The result is a rather complex R object:

https://wolfram.com/xid/0rrp6ajb22kk8-hwm8ux

It contains certain elements that are not directly supported by RLink, particularly formulas and unevaluated R code:

https://wolfram.com/xid/0rrp6ajb22kk8-fdjnx9

Some of these elements are parts of the object's attributes rather than the object's data. These are the attributes of the linear model R object:

https://wolfram.com/xid/0rrp6ajb22kk8-b045ut

Inspecting them, you can find such attributes:

https://wolfram.com/xid/0rrp6ajb22kk8-wq4ki


https://wolfram.com/xid/0rrp6ajb22kk8-hr8spz

Wolfram Research (2012), RCode, Wolfram Language function, https://reference.wolfram.com/language/RLink/ref/RCode.html.
Text
Wolfram Research (2012), RCode, Wolfram Language function, https://reference.wolfram.com/language/RLink/ref/RCode.html.
Wolfram Research (2012), RCode, Wolfram Language function, https://reference.wolfram.com/language/RLink/ref/RCode.html.
CMS
Wolfram Language. 2012. "RCode." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/RLink/ref/RCode.html.
Wolfram Language. 2012. "RCode." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/RLink/ref/RCode.html.
APA
Wolfram Language. (2012). RCode. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/RLink/ref/RCode.html
Wolfram Language. (2012). RCode. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/RLink/ref/RCode.html
BibTeX
@misc{reference.wolfram_2024_rcode, author="Wolfram Research", title="{RCode}", year="2012", howpublished="\url{https://reference.wolfram.com/language/RLink/ref/RCode.html}", note=[Accessed: 26-March-2025
]}
BibLaTeX
@online{reference.wolfram_2024_rcode, organization={Wolfram Research}, title={RCode}, year={2012}, url={https://reference.wolfram.com/language/RLink/ref/RCode.html}, note=[Accessed: 26-March-2025
]}