R - Class

Card Puncher Data Processing

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"





Discover More
Card Puncher Data Processing
ORE - Install 1.3.1

grant rqrole to grant execute on rqsys.rqGroupEvalImpl for each user. Create all the synonyms listed in rquser.sql for each user. startup scriptfunctions ore.attach(USER, SID, host, password) establishes...
Card Puncher Data Processing
R - (Fitting) Linear Model (lm)

lm is a class that contains fitting function.
Card Puncher Data Processing
R - (Object|Variable|Symbol)

R provides a number of specialized objects. They are created (instantiated), used and referenced through variable (known as symbol). When you read the term object in the documentation, you can interchange...
Card Puncher Data Processing
R - Array

An array is an array of n dimensions with the same class (data type)
Card Puncher Data Processing
R - Attribute of an object

where:
Card Puncher Data Processing
R - Condition

A condition is a length-one logical vector (FALSE of TRUE) that is not NA. Conditions are always evaluated from left to right.
R Studio Import Dataset
R - Data frame Object

A data frame is a logical implementation of a table in a relational database A data frame inherits all the property and function of an object. It has a list of variables of the same number of rows with...
Card Puncher Data Processing
R - Factor (Category, Enumerated Type)

The factor function is used to encode a vector as a factor (ie categorical data). When used with a numeric or a date, a binning function will return a factor. From numeric to a category (For instance,...
Card Puncher Data Processing
R - Function

Functions are stored as R objects with the class function Functions can be: used as arguments of other functions nested where: arglist is a list of argument including the three dot argument....
Card Puncher Data Processing
R - Inf (Infinity Constant)

Inf represents the infi nity class



Share this page:
Follow us:
Task Runner