[Rd] inherits() and virtual classes

From: Robin Hankin <r.hankin_at_noc.soton.ac.uk>
Date: Wed, 27 Jun 2007 08:19:37 +0100


Hi

How do I test for an object having a particular virtual class?

In the following, "onion" is a virtual class, and "octonion" is a non-virtual class contained in onion. The last call to inherits() gives FALSE [R-2.5.0], when inherits.Rd led me to expect TRUE.

setClass("onion",

          representation = "VIRTUAL"

)
setClass("octonion", representation = representation(x="matrix"), prototype = list(x=matrix(numeric(),0,8)), contains = "onion"
)

jj <- new("octonion",x=as.matrix(1:8))

inherits(jj,"onion")

--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
  tel  023-8059-7743

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Wed 27 Jun 2007 - 07:22:52 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 27 Jun 2007 - 11:35:52 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.