Martin Morgan wrote:
Gabor Grothendieck wrote:
Try this:
setClass("zoo")
[1] "zoo"
'zoo' is I guess intended as an S3 class (from library zoo), so
setOldClass('zoo') is appropriate. Otherwise, setClass("zoo") creates a
new virtual class.
setClass("Work",representation=(x="zoo"))
This syntax representation=(x="zoo") is doing something quite strange;
Strange? If there's is something strange here, it's is the idea that
setClass('bar', representation=c('foo'))
creates a subclass of 'foo', while
setClass('bar', representation=c(x='foo'))
creates a class with 'foo' as a component. it's just a design choice,
but it's confusing and surely begging for trouble. but given this is as
it is, there is nothing strange with
setClass('bar', representation=(x='foo'))
as far as i am able to understand r, it's equivalent to
x = 'foo'
setClass('bar', representation='foo')
hence, bar extends foo. just a little and useless pattern.
vQ
______________________________________________
R-help@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.