[R] How to check the code for generic function in a specific package?
Liaw, Andy
andy_liaw at merck.com
Tue Jul 6 19:09:01 CEST 2004
What version of R are you using? In R-1.9.1 (on WinXPPro), I get:
> boxplot
function (x, ...)
UseMethod("boxplot")
<environment: namespace:graphics>
... and that _is_ what an S3 generic looks like. I suspect you really want
to define a boxplot method for some class for which there's no boxplot
method yet. If so, just create a function named boxplot.myclass (substitute
`myclass' for the name of the class). If you want to see what the default
method looks like for boxplot, type boxplot.default (which is _not_ hidden
behind the namespace for `graphics').
Andy
> From: F Duan
>
> Thanks for your answer. My problem is:
>
> For example, I want to check the code for function "boxplot"
> and do some
> modifications in a specific package, but "boxplot" has also
> been defined in
> another package (e.g., graphics). Therefore, when I type "boxplot" or
> "fix(boxplot)" at the R prompt, I only get a message like:
>
> > boxplot
> standardGeneric for "boxplot" defined from package "graphics"
>
> function (x, ...)
> standardGeneric("boxplot")
> <environment: 02D4FC14>
> Methods may be defined for arguments: x
>
>
> There is no source code pop-up, either for the package
> "graphics" or the
> package I am working with.
>
> Frank Duan
>
>
> -----Original Message-----
> From: Uwe Ligges [mailto:ligges at statistik.uni-dortmund.de]
> Sent: Monday, July 05, 2004 17:58
> To: F Duan
> Cc: r-help at stat.math.ethz.ch
> Subject: Re: [R] How to check the code for generic function
> in a specific
> package?
>
> F Duan wrote:
>
> > Hello, R people,
> >
> >
> >
> > I am a R beginner. I searched the R-FAQ and R-help and
> failed to find the
> > answers.
> >
> >
> >
> > Could anyone tell me how to check (or edit) a generic
> function within a
> > specific package? If the function is not generic, I can
> just type the
> > function name at the R prompt or use "fix()" and "edit()".
>
> fix() *does* work for me, giving you expect that the fucntion is not
> "fixed" within the package, but a new (changed) instance is
> created in
> your Workspace.....
>
> What do you expect to happen? What is the error message (if
> there is any)?
>
> In order to change packages, you might want to edit the
> package sources
> directly.
>
> Uwe Ligges
>
>
>
> >
> >
> > Thanks a lot.
> >
> >
> >
> > Frank
> >
> >
> > [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
>
More information about the R-help
mailing list