Re: [R] Injecting code in a package?

From: Uwe Ligges <ligges_at_statistik.tu-dortmund.de>
Date: Fri, 28 Jan 2011 15:10:51 +0100

On 28.01.2011 14:57, Nick Sabbe wrote:
> Dear list,
>
>
>
> I've had this a few times now, and wonder if this is possible:
>
> I'm using a package, often for plotting something, but I want to tune the
> way the plotting goes, in a way that was not foreseen by the maker of the
> package.
>
> Now, most of the time, these kinds of R functions (say pkg::plot.something)
> call into other R functions (say pkg::plot.something.internal), and it is
> these that I want to tinker with.
>
>
>
> So, my question is: can I replace an R function in a package with a version
> of my own, without having to somehow rebuild the package? I don't just want
> a non-package bound copy of the function, I want to make sure that when I
> call pkg::plot.something, this works as before, but when, from within this
> function, pkg:: plot.something.internal is called, I want it to call _my_
> version of it.
>
>
>
> Any takes?

For just doing it once:
See ?fixInNamespace and ?assignInNamespace

Other ideas:
- Compile the package with changed functionality for your own. - Contribute to the existing package and add the features you like to see

Uwe Ligges

>
>
> Nick Sabbe
>
> --
>
> ping: nick.sabbe@ugent.be
>
> link:<http://biomath.ugent.be/> http://biomath.ugent.be
>
> wink: A1.056, Coupure Links 653, 9000 Gent
>
> ring: 09/264.59.36
>
>
>
> -- Do Not Disapprove
>
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Fri 28 Jan 2011 - 14:28:57 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 28 Jan 2011 - 14:30:09 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive