Table of Contents

About

A class is just an attribute of an object. You can remove the attribute with the function unclass. The class with then become the type

A list can have different class.

Management

Unclass

unclass returns (a copy of) its argument with its class attribute removed. (It is not allowed for objects which cannot be copied, namely environments and external pointers.)

Example: A data frame will return a list:

class(USArrests)
[1] "data.frame"

If you unclass it, you will get a list

class(unclass(USArrests))
[1] "list"

Change

Objects can change of class (coercion) using the as.* functions (if available).

Type

Atomic

Non Atomic

Hierarchy

The following hierarchy (order of precedence) occurs when creating an object with several classes:

  1. NULL
  2. raw
  3. numeric (double)
  4. expression
  5. function

? And:

Example

List

See R - List

Function

R - Function

class(mean)
[1] "function"

> class(plot)
[1] "function"