Dear R-ers, I don't understand the following, maybe someone will help me explain:> setClasss('A')[1] "A"> new('a')Error in new("a") : trying to generate an object from a virtual class ("a")> setClass('b', contains='a')[1] "b"> new('b')An object of class ?b? <S4 Type Object> In what way is B more concrete than A so that it's possible do instantiate B but not A? I don't quite get it. B adds nothing to nothing, and yet it's instantiable, while it's base is not. Makes no sense to me. -- Hun
PS. All class names were upper-case, I messed up while copying the code, but it has no effect on the result. Thanks for help. --Hun On Mon, 23 Nov 2009 10:28:37 +0100 "Hun S. Tesatte" <hunsyntesat at hush.com> wrote:>Dear R-ers, > >I don't understand the following, maybe someone will help me >explain: > >> setClasss('A') >[1] "A" >> new('a') >Error in new("a") : > trying to generate an object from a virtual class ("a") > >> setClass('b', contains='a') >[1] "b" >> new('b') >An object of class ?b? ><S4 Type Object> > >In what way is B more concrete than A so that it's possible do >instantiate B but not A? I don't quite get it. B adds nothing to >nothing, and yet it's instantiable, while it's base is not. Makes >no sense to me. > >-- Hun
I'm curious about why no one has answered my question below. I can't imagine it would be because no one knows how to answer, it must be something basic I am ignorant about. But I have never seen such a pattern, it seems strange to me that a class with an empty definition is automatically virtual, but a class extending it without adding anything is not. I am really puzzled, there must be some design decision behind this, but I can't figure out it's purpose and usefulness. I'd really appreciate an explanation. Thank you. -- Hun Dear R-ers, I don't understand the following, maybe someone will help me explain:> > setClasss('A')[1] "A"> > new('a')Error in new("a") : trying to generate an object from a virtual class ("a")> > setClass('b', contains='a')[1] "b"> > new('b')An object of class ?b? <S4 Type Object> In what way is B more concrete than A so that it's possible do instantiate B but not A? I don't quite get it. B adds nothing to nothing, and yet it's instantiable, while it's base is not. Makes no sense to me. -- Hun