Janko Thyson
2011-May-30 14:02 UTC
[R] Is there a (virtual) class that all R objects inherit from?
Dear list, I would like to set one specific Reference Class field to be of an arbitrary class. Is there a class that all R objects inherit from? I thought that "ANY" was something like this, but obviously that's not true: > inherits(1:3, "ANY") [1] FALSE Regards, Janko [[alternative HTML version deleted]]
Martin Morgan
2011-May-31 16:17 UTC
[R] Is there a (virtual) class that all R objects inherit from?
On 05/30/2011 07:02 AM, Janko Thyson wrote:> Dear list, > > I would like to set one specific Reference Class field to be of an > arbitrary class. Is there a class that all R objects inherit from? I > thought that "ANY" was something like this, but obviously that's not true: > > > inherits(1:3, "ANY") > [1] FALSEI can't speak to the implementation, but ANY functions as a base class in terms of slot / field assignment and inheritance, e.g., setClass("A", representation(x="ANY")) new("A", x=1:3) Martin> > Regards, > Janko > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.-- Computational Biology Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109 Location: M1-B861 Telephone: 206 667-2793
Reasonably Related Threads
- Bug or feature: using "ANY" as a generic field class (was: '[R] Is there a (virtual) class that all R objects inherit from?)
- Query super- and subclasses of a class: is there a better way than to use 'completeClassDefinition()'
- WG: Reference classes: error with missing arguments in method calls
- S4 Reference Classes: declaring public and private methods
- Reference Classes/S4 Classes: can method dispatch check superclasses BEFORE resorting to method for "ANY"?