Any insight as to why this is printing twice?

"[.mydist" <- function(x,...){
    print("I called my function")
}

m <- a_mydist_obj
m[]

I called my function
I called my function




On 3/12/07, Sender <exonintron@gmail.com> wrote:
>
> Super. Thanks for the leads.
>
> On 3/12/07, Marc Schwartz <marc_schwartz@comcast.net> wrote:
> >
> > On Mon, 2007-03-12 at 21:28 -0700, Sender wrote:
> > > Hello:
> > >
> > > Could anyone point me to a nice example where someone has created
> > methods
> > > for "[" on a user defined Class?
> > >
> > > I looked at the package Matrix but that was a little daunting. I'm
> > looking
> > > for someone a little more introductory. I've tried to search the help
> > > section and the web but its difficult since "[" isn't searchable.
> > >
> > > Thanks in advance!
> > >
> > > Greg
> >
> > You might want to look at this thread from last year:
> >
> >   http://finzi.psych.upenn.edu/R/Rhelp02a/archive/77057.html
> >
> >    http://finzi.psych.upenn.edu/R/Rhelp02a/archive/77060.html
> >
> >   http://finzi.psych.upenn.edu/R/Rhelp02a/archive/77059.html
> >
> >    http://finzi.psych.upenn.edu/R/Rhelp02a/archive/77102.html
> >
> >
> > You can also review the existing methods defined for '[' in your current
> > installation by using:
> >
> >   methods("[")
> >
> > It may be easiest to then review the code for a given method by using
> > something like the following as an example:
> >
> >   getAnywhere("[.data.frame")
> >
> >
> > BTW, for searching the R help files, REGEX's are used, so for "[", you
> > would need:
> >
> >   help.search ("\\[")
> >
> > since '[' is a special character in regular expressions and you need to
> > escape it to search on the literal character. In R, you need to double
> > the '\' to be interpreted properly.
> >
> > HTH,
> >
> > Marc Schwartz
> >
> >
> >
>

	[[alternative HTML version deleted]]

