RList.opIndex

Allows access to the elements of an RList by index number or by name. Note that it returns an Robj, which may or may not be protected. This is an example of the intended use case:

  1. Robj opIndex(int ii)
    struct RList
    opIndex
    (
    int ii
    )
  2. Robj opIndex(string name)

Examples

Create an RList from rx that is passed from R.

auto x = RList(rx);

Create an RMatrix from the first element in the list.

auto m = RMatrix(x[0]);

Create an RMatrix from the element named mat.

auto m2 = RMatrix(x["mat"]);

Meta