RClassUtils

0th

Percentile

Utilities for Managing Class Definitions

These are various functions to support the definition and use of formal classes. Most of them are rarely suitable to be called directly.

Others are somewhat experimental and/or partially implemented only. Do refer to setClass for normal code development.

Keywords
internal
Usage
classLabel(Class)
.classEnv(Class, default = .requirePackage("methods"), mustFind = TRUE)

testVirtual(properties, extends, prototype, where)

makePrototypeFromClassDef(slots, ClassDef, extends, where)

newEmptyObject()

completeClassDefinition(Class, ClassDef, where, doExtends)

getAllSuperClasses(ClassDef, simpleOnly = TRUE)

superClassDepth(ClassDef, soFar, simpleOnly = TRUE)

isVirtualClass(Class, where)

newBasic(Class, ...)

makeExtends(Class, to, coerce, test, replace, by, package, slots, classDef1, classDef2)

reconcilePropertiesAndPrototype(name, properties, prototype, superClasses, where)

tryNew(Class, where)

empty.dump()

showClass(Class, complete=TRUE, propertiesAreCalled="Slots")

showExtends(ext, printTo = stdout())

possibleExtends(class1, class2, ClassDef1 = getClassDef(class1), ClassDef2 = getClassDef(class2, where = .classEnv(ClassDef1)))

completeExtends(ClassDef, class2, extensionDef, where)

classMetaName(name)

methodsPackageMetaName(prefix, name, package = "")

metaNameUndo(strings, prefix, searchForm = FALSE)

requireMethods(functions, signature, message, where)

checkAtAssignment(cl, name, valueClass) checkSlotAssignment(obj, name, value)

defaultPrototype()

isClassDef(object)

validSlotNames(names)

getDataPart(object) setDataPart(object, value, check = TRUE)

Aliases
  • completeSubclasses
  • newClassRepresentation
  • print.classRepresentation
  • setExtendsMetaData
  • setSubclassMetaData
  • subclassesMetaName
  • extendsMetaName
  • classPrototypeDef-class
  • .classEnv
  • classLabel
  • testVirtual
  • makePrototypeFromClassDef
  • newEmptyObject
  • completeClassDefinition
  • getAllSuperClasses
  • superClassDepth
  • isVirtualClass
  • assignClassDef
  • newBasic
  • makeExtends
  • reconcilePropertiesAndPrototype
  • tryNew
  • empty.dump
  • showClass
  • showExtends
  • possibleExtends
  • completeExtends
  • classMetaName
  • methodsPackageMetaName
  • metaNameUndo
  • requireMethods
  • checkAtAssignment
  • checkSlotAssignment
  • defaultPrototype
  • isClassDef
  • validSlotNames
  • getDataPart
  • setDataPart
  • .BasicClasses
  • .BasicVectorClasses
  • .InitBasicClasses
  • .InitMethodsListClass
  • .setCoerceGeneric
  • conditionalExtension-class
Examples
library(methods) typeof(defaultPrototype()) #-> "S4" ## .classEnv() meth.ns <- asNamespace("methods") if(get4 <- !any("package:stats4" == search())) require("stats4") stopifnot(TRUE , identical(.classEnv("data.frame"), meth.ns) , identical(.classEnv(class(new("data.frame"))), meth.ns) , identical(.classEnv( "mle" ), meth.ns) # <- *not* 'stats4' , identical(.classEnv(class(new("mle"))), asNamespace("stats4")) , identical(.classEnv(getClass ("mle") ), asNamespace("stats4")) ) if(get4) detach("package:stats4")
Documentation reproduced from package methods, version 3.3, License: Part of R @VERSION@

Community examples

Looks like there are no examples yet.