Re: [R] help with oop in R - class structure and syntex

2008-02-06 Thread Gabor Grothendieck
zoo has a NAMESPACE which restricts access to the internals of the package except for explicitly exported items. zoo exports plot.zoo as an S3 method so that the plot generic can find it. It is also possible to simply export a function not specifically as an S3 method in which case it will be visi

Re: [R] help with oop in R - class structure and syntex

2008-02-06 Thread tom soyer
Gabor, maybe I am not understanding it right. I was thinking for example something like how a call to plot actually calls plot.zoo when zoo is loaded. And a specific call to plot.zoo would not work, etc. One would think that plot and plot.zoo are separate and that one could call the parent as well

Re: [R] help with oop in R - class structure and syntex

2008-02-06 Thread Gabor Grothendieck
If you believe that certain changes intended only to affect the local environment nevertheless affect the global environment please give a code example. On Feb 6, 2008 12:11 PM, tom soyer <[EMAIL PROTECTED]> wrote: > Thanks Hardley. I see what you mean. You are right, I am not an expert in > oop A

Re: [R] help with oop in R - class structure and syntex

2008-02-06 Thread tom soyer
Thanks Hardley. I see what you mean. You are right, I am not an expert in oop AND I don't really know how R oo works, so certainly I shouldn't be making any sweeping statement. I was just thinking about the issue of local vs. global, i.e. changes intended for the local environment shouldn't affect

Re: [R] help with oop in R - class structure and syntex

2008-02-06 Thread hadley wickham
On Feb 6, 2008 10:13 AM, tom soyer <[EMAIL PROTECTED]> wrote: > Thanks Gabor. I guess true oo encapsulation is not possible in R. Before making such a claim, I would encourage you to actually learn what oo means. A couple of good readings are: Structure and Interpretation of Computer Programs. h

Re: [R] help with oop in R - class structure and syntex

2008-02-06 Thread tom soyer
Thanks Gabor. I guess true oo encapsulation is not possible in R. It seems that there is an IDE for S+ in Eclipse... On 2/6/08, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > > On Feb 6, 2008 9:45 AM, tom soyer <[EMAIL PROTECTED]> wrote: > > Thanks Gabor for illustrating the basics oop in R us

Re: [R] help with oop in R - class structure and syntex

2008-02-06 Thread Jeffrey J. Hallman
"tom soyer" <[EMAIL PROTECTED]> writes: > (1) how do I encapsulate the generics? i.e., if a class has 100 methods, > then does it mean 100 generics would be dumped in the global environment? > Or, is it possible to define a local environment and restrict the generics > from one class to a particula

Re: [R] help with oop in R - class structure and syntex

2008-02-06 Thread Gabor Grothendieck
On Feb 6, 2008 9:45 AM, tom soyer <[EMAIL PROTECTED]> wrote: > Thanks Gabor for illustrating the basics oop in R using S3. Maybe I didn't > have the right documents, but you example taught me more about oop in R than > everything else I read combined! Thanks for the tip on R.oo, I plan to check > i

Re: [R] help with oop in R - class structure and syntex

2008-02-06 Thread tom soyer
Thanks Gabor for illustrating the basics oop in R using S3. Maybe I didn't have the right documents, but you example taught me more about oop in R than everything else I read combined! Thanks for the tip on R.oo, I plan to check it out later. I have a few followup questions... (1) how do I encaps

Re: [R] help with oop in R - class structure and syntex

2008-02-05 Thread Luke Tierney
On Tue, 5 Feb 2008, Barry Rowlingson wrote: > Duncan Murdoch wrote: > >> Another problem is that there are two different class systems in R: >> sometimes calls S3 and S4 (because of the versions of S where they were >> introduced). You were reading about S3. > > There's three different class sys

Re: [R] help with oop in R - class structure and syntex

2008-02-05 Thread Henrik Bengtsson
On Feb 5, 2008 6:06 AM, Barry Rowlingson <[EMAIL PROTECTED]> wrote: > Duncan Murdoch wrote: > > > Another problem is that there are two different class systems in R: > > sometimes calls S3 and S4 (because of the versions of S where they were > > introduced). You were reading about S3. > > There'

Re: [R] help with oop in R - class structure and syntex

2008-02-05 Thread Barry Rowlingson
Duncan Murdoch wrote: > Another problem is that there are two different class systems in R: > sometimes calls S3 and S4 (because of the versions of S where they were > introduced). You were reading about S3. There's three different class systems if you also include the R.oo add-on package[1

Re: [R] help with oop in R - class structure and syntex

2008-02-05 Thread Gabor Grothendieck
On Feb 5, 2008 9:09 AM, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > This illustration uses S3. Note that functions do not modify their arguments > so to modify an object we have to pass it to the method and then pass the > object back. There is also another system called S4 which involves typ

Re: [R] help with oop in R - class structure and syntex

2008-02-05 Thread Gabor Grothendieck
This illustration uses S3. Note that functions do not modify their arguments so to modify an object we have to pass it to the method and then pass the object back. There is also another system called S4 which involves typing of arguments and there are packages proto and R.oo which provide differe

Re: [R] help with oop in R - class structure and syntex

2008-02-05 Thread Duncan Murdoch
On 2/5/2008 8:21 AM, tom soyer wrote: > Hi, > > I read section 5, oop, of the R lang doc, and I am still not sure I > understand how to build a class in R for oop. I thought that since I > understand the oop syntex of Java and VB, I am wondering if the R programmig > experts could help me out by c

[R] help with oop in R - class structure and syntex

2008-02-05 Thread tom soyer
Hi, I read section 5, oop, of the R lang doc, and I am still not sure I understand how to build a class in R for oop. I thought that since I understand the oop syntex of Java and VB, I am wondering if the R programmig experts could help me out by comparing and contrasting the oop syntex in R with