chapter  6
12 Pages

Objects

ByJohn M. Chambers

This chapter discusses some topics about objects in R that may be helpful in planning and implementing extensions. If everything that exists is an object, what does that mean about their internal structure? What resources do objects need and how are they managed? Since environments are essential for object references in R, how should one think about environments as objects? The type SEXP is a single structure defined in the internal C code for R. The C structure is composed of a variety of internal fields. Two fields are important in programming: the type and the attributes. R is implemented as a C program, so memory management uses the C-style storage mechanisms in a variety of ways. Special lists are used in C level programming to protect objects that are not assigned in R but need to stay around at the C level, temporarily or permanently.