R - Coerce methods (Object Class conversion)

> Procedural Languages > R

1 - About

Type Coercion in R.

The function as turns object into an object of class Class. In doing so, it applies a “coerce method”.

The implicitly defined coerce methods may be overridden by a call to setAs.

Advertising

3 - Signature

Coerce methods have two arguments in method signatures:

  • from: the class of the object
  • to: the desired coerce class.

These functions must not be called directly, but are used to store tables of methods for the use of as, directly and for replacements.

4 - Method

methods/html/showMethods.html">showMethods("coerce")
Function: coerce (package methods)
from="ANY", to="array"
from="ANY", to="call"
from="ANY", to="character"
from="ANY", to="complex"
from="ANY", to="environment"
from="ANY", to="expression"
from="ANY", to="function"
from="ANY", to="integer"
from="ANY", to="list"
from="ANY", to="logical"
from="ANY", to="matrix"
from="ANY", to="name"
from="ANY", to="NULL"
from="ANY", to="numeric"
from="ANY", to="S3"
from="ANY", to="S4"
from="ANY", to="ts"
from="ANY", to="vector"
from="character", to="signature"
from="character", to="SuperClassMethod"
from="color", to="HLS"
from="color", to="HSV"
from="color", to="LAB"
from="color", to="LUV"
from="color", to="polarLAB"
from="color", to="polarLUV"
from="color", to="RGB"
from="color", to="sRGB"
from="color", to="XYZ"
from="derivedDefaultMethod", to="function"
from="function", to="classGeneratorFunction"
from="function", to="OptionalFunction"
from="groupGenericFunction", to="genericFunction"
from="NULL", to="OptionalFunction"
from="NULL", to="optionalMethod"
from="oldClass", to="S3"

5 - Documentation / Reference

?methods/html/coerce.html">coerce
?methods/html/as.html">as
lang/r/coerce.txt · Last modified: 2017/09/06 09:16 by gerardnico