R: Classes Corresponding to Basic Data Types

BasicClasses {methods} | R Documentation

## Classes Corresponding to Basic Data Types

### Description

Formal classes exist corresponding to the basic R object types, allowing these types to be used in method signatures, as slots in class definitions, and to be extended by new classes.

### Usage

    ### The following are all basic vector classes.
    ### They can appear as class names in method signatures,
    ### in calls to as(), is(), and new().
    "character"
    "complex"
    "double"
    "expression"
    "integer"
    "list"
    "logical"
    "numeric"
    "single"
    "raw"

    ### the class
    "vector"
    ### is a virtual class, extended by all the above

    ### the class
    "S4"
    ### is an object type for S4 objects that do not extend
    ### any of the basic vector classes.  It is a virtual class.

    ### The following are additional basic classes
    "NULL"     #  NULL objects
    "function" #  function objects, including primitives
    "externalptr" # raw external pointers for use in C code

    "ANY"  # virtual classes used by the methods package itself
    "VIRTUAL"
    "missing"

### Objects from the Classes

Objects can be created by calls of the form `new(Class, ...)`, where `Class` is the quoted class name, and the remaining arguments if any are objects to be interpreted as vectors of this class. Multiple arguments will be concatenated.

The class `"expression"` is slightly odd, in that the ... arguments will not be evaluated; therefore, don't enclose them in a call to `quote()`.

### Extends

Class `"vector"`, directly.

### Methods

coerce
  Methods are defined to coerce arbitrary objects to these classes, by calling the corresponding basic function, for example, `as(x, "numeric")` calls `as.numeric(x)`.

[Package methods version 2.8.1 Index]