Chapter 13 List

This chapter explains how to create List object, how to access its elements, and its member functions. In Rcpp, List is implemented as a kind of vector. In other words, Vector is a vector whose element is scalar value, while List is a vector whose elements are any kinds of data types. Therefore, Vector and List have many common methods of creating objects, accessing elements, and member functions.

Since the contents described on the page of DataFrame can be mostly valid by replacing DataFrame withList, please refer to that for details.

13.1 Creating List object

To create a List object we use the List::create() function. Also, to specify the element name when creating List, use Named() function or _[].

13.2 Accessing List elements

When accessing a specific element of List, we assign it to the other object and access it via that object.

The elements of List can be specified by numerical index, element names and logical vector.

13.3 Member functions

List has the same member functions as Vector.