RList
RList[{elems},attributes]
represents an internal form of an R list in RLink.
Details and Options
- The elements elems can be of any valid RLink object type.
- attributes must have the form RAttributes["name1":>value1,...], where values of attributes can be any R objects handled by RLink.
Examples
Basic Examples (9)Summary of the most common use cases

https://wolfram.com/xid/0enm9acjqhc4q-ugqbs
Like with RVector, most of the time, you will find it more convenient to use the short form of a list, rather than using RList directly. For example, a pair of an integer and a real number can be represented simply as:

https://wolfram.com/xid/0enm9acjqhc4q-d7a0dt

Yo can use ToRForm to see the internal form of this list, which would involve RList:

https://wolfram.com/xid/0enm9acjqhc4q-c3fb0

One reason to use the head RList explicitly is when you want to treat some data as a list, which the automatic type detection of RLink would otherwise classify as a vector. For example, consider the following nested list:

https://wolfram.com/xid/0enm9acjqhc4q-b96lxd

It will be considered as a vector by default:

https://wolfram.com/xid/0enm9acjqhc4q-bhsiyo

To force the list interpretation, you can use the following instead:

https://wolfram.com/xid/0enm9acjqhc4q-ct852

It is now interpreted as a list:

https://wolfram.com/xid/0enm9acjqhc4q-d5n67b

The same will also happen for a flattened list of data:

https://wolfram.com/xid/0enm9acjqhc4q-b26wa

The confusion can only happen for lists representing regular arrays. Ragged lists are always interpreted as R lists:

https://wolfram.com/xid/0enm9acjqhc4q-igc5y

You can always check yourself with FromRForm function: the call to ToRForm followed by the call to FromRForm should produce back the short form of your input:

https://wolfram.com/xid/0enm9acjqhc4q-eh0rnq

As with RVector, you can send instances of RList directly to R:

https://wolfram.com/xid/0enm9acjqhc4q-dgd5hz

You can always check what was sent to R by using REvaluate:

https://wolfram.com/xid/0enm9acjqhc4q-b3zax6

Also, as with RVector, the case when you assign some extra attributes is treated differently. Consider the following example:

https://wolfram.com/xid/0enm9acjqhc4q-bmz81u

The short (involving only lists) form of the Wolfram Language representation of your R object is no longer possible, since you have to store the attributes somewhere:

https://wolfram.com/xid/0enm9acjqhc4q-lmud1v

Note that the same ambiguity can happen here as well:

https://wolfram.com/xid/0enm9acjqhc4q-kl13rc

As you can see, lists were interpreted as vectors here. Here is the form that will force the list interpretation in this case:

https://wolfram.com/xid/0enm9acjqhc4q-l0thkl

Now the lists will be interpreted as R lists rather than R vectors:

https://wolfram.com/xid/0enm9acjqhc4q-ey8sep

Here is an example of a more complex list:

https://wolfram.com/xid/0enm9acjqhc4q-fae1b2

You can see that generally, it is a lot easier to work with the above short form than with a full internal form:

https://wolfram.com/xid/0enm9acjqhc4q-bc89yo


https://wolfram.com/xid/0enm9acjqhc4q-finwl0


https://wolfram.com/xid/0enm9acjqhc4q-qq2fs

You can check that they are the same in R:

https://wolfram.com/xid/0enm9acjqhc4q-eju1px

Which, of course, means that they are the same when pulled back to the Wolfram Language:

https://wolfram.com/xid/0enm9acjqhc4q-bkrb1b

This is a bit tangential to the present discussion, but there are two types of indexing possible for lists in R. Here is an example of the one with the same syntax as array indexing:

https://wolfram.com/xid/0enm9acjqhc4q-jn2d0

It provides an R list with a given element. The other one is the one with the double square bracket syntax, and it truly extracts the element:

https://wolfram.com/xid/0enm9acjqhc4q-dvnq4r

This is reflected on the Wolfram Language side by the first result being wrapped in an extra List. This is also consistent with the conversion to the internal RLink form:

https://wolfram.com/xid/0enm9acjqhc4q-dtkpp0


https://wolfram.com/xid/0enm9acjqhc4q-ddx8tp

You should keep this difference in mind when working with R lists in RLink.
Wolfram Research (2012), RList, Wolfram Language function, https://reference.wolfram.com/language/RLink/ref/RList.html.
Text
Wolfram Research (2012), RList, Wolfram Language function, https://reference.wolfram.com/language/RLink/ref/RList.html.
Wolfram Research (2012), RList, Wolfram Language function, https://reference.wolfram.com/language/RLink/ref/RList.html.
CMS
Wolfram Language. 2012. "RList." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/RLink/ref/RList.html.
Wolfram Language. 2012. "RList." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/RLink/ref/RList.html.
APA
Wolfram Language. (2012). RList. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/RLink/ref/RList.html
Wolfram Language. (2012). RList. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/RLink/ref/RList.html
BibTeX
@misc{reference.wolfram_2024_rlist, author="Wolfram Research", title="{RList}", year="2012", howpublished="\url{https://reference.wolfram.com/language/RLink/ref/RList.html}", note=[Accessed: 17-May-2025
]}
BibLaTeX
@online{reference.wolfram_2024_rlist, organization={Wolfram Research}, title={RList}, year={2012}, url={https://reference.wolfram.com/language/RLink/ref/RList.html}, note=[Accessed: 17-May-2025
]}