[Rd] S4 classes and objects -- fixed structure? No...

2006-08-28 Thread Jörg Beyer
Hello. Suppose you define a new S4-class, say setClass(track, representation(x=numeric, y=numeric)) Don't worry if you have a deja vu, it's from the help page. Your new class is said to have a fixed structure: two slots, x, and y, and that should apply to all objects you construct as members

Re: [Rd] S4 classes and objects -- fixed structure? No...

2006-08-28 Thread Gabor Grothendieck
Under R 2.3.1 these work as you indicate but under R 2.4.0 they all give errors: setClass(track, representation(x=numeric, y=numeric)) [1] track tr - new( track ) tr[ ping ] - pong Error in [-(`*tmp*`, ping, value = pong) : object is not subsettable tr$bingo - bongo Error: cannot

Re: [Rd] S4 classes and objects -- fixed structure? No...

2006-08-28 Thread Roger D. Peng
I think you're right---this shouldn't happen in theory, but it does because of the internal representation of S4 objects in R. In R devel (to be 2.4.0), this changes and I believe your example will no longer work. -roger Jörg Beyer wrote: Hello. Suppose you define a new S4-class, say

Re: [Rd] S4 classes and objects -- fixed structure? No...

2006-08-28 Thread Jörg Beyer
Gabor, Roger, thanks a lot for your immediate answers. Knowing that this is subject to change means a lot less coding for me :-) Good news ... for me, and first of all for the impressing S4 system. Thanks again Joerg Am 28.08.2006 16:08 Uhr schrieb Gabor Grothendieck ([EMAIL PROTECTED]):