Skip to content

oldClass vs. class

2 messages · ronggui, Brian Ripley

#
Hi,When I read the source of str,i find  these code
-----
  ## Show further classes // Assume that they do NOT have an own Method --
    ## not quite perfect ! (.Class = 'remaining classes', starting with current)
    cl <- oldClass(object); cl <- cl[cl != "data.frame"]  #- not THIS class
-----
so I use ?oldClass to try to learn more about oldClass.But after I have reading all the help page ,I still have no idea the diiference between oldClass and class.

Anynone can help me ?


2005-08-06

------
Deparment of Sociology
Fudan University

Blog:http://sociology.yculblog.com
#
On Sat, 6 Aug 2005, ronggui wrote:

            
Many R objects have a 'class' attribute, a character vector giving
      the names of the classes which the object "inherits" from.  If the
      object does not have a class attribute, it has an implicit class,
      '"matrix"', '"array"' or the result of 'mode(x)'.  (Functions
      'oldClass' and 'oldClass<-' get and set the attribute, which can
      also be done directly.)

so class returns the implicit class, and oldClass does not.
[1] "matrix"
NULL

just as it says.