Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
We’ll end this chapter with a brief summary of useful functions for working with data objects (see table 2.3).
| Function | Purpose |
|---|---|
| length(object) | Number of elements/components. |
| dim(object) | Dimensions of an object. |
| str(object) | Structure of an object. |
| class(object) | Class or type of an object. |
| mode(object) | How an object is stored. |
| names(object) | Names of components in an object. |
| c(object, object,...) | Combines objects into a vector. |
| cbind(object, object, ...) | Combines objects as columns. |
| rbind(object, object, ...) | Combines objects as rows. |
| object | Prints the object. |
| head(object) | Lists the first part of the object. |
| tail(object) | Lists the last part of the object. |
| Is() | Lists current objects. |
| rm(object, object, ...) | Deletes one or more objects. The statement rm(list = Is()) will remove most objects from the working environment. |
| newobject <- edit(object) | Edits object and saves as newobject. |
| fix(object) | Edits in place. |