[R] how to override/replace a function in a package namespace?
friendly at yorku.ca
Sun Aug 17 19:34:28 CEST 2008
For the record, what I was looking for is accomplished by
> assignInNamespace("strucplot",strucplot, ns="vcd")
Gabor Grothendieck wrote:
> Check out:
> On Sun, Aug 17, 2008 at 12:42 PM, Michael Friendly <friendly at yorku.ca> wrote:
>> I'm trying to test an extension of mosaic() from the vcd package that
>> requires a change to the
>> basic strucplot() function from that package. I want to test my change by
>> sourcing the
>> replacement function into my R session.
>> But when I do that,
>> and run my extension, it is apparent that it is vcd:::strucplot that is
>> eventually called, not
>> my replacement. Thus, I'm looking for something with the semantics and
>> effect of
>> source("c:/R/mosaics/strucplot-MF.R", namespace="vcd")
>> that would replace the package version with my testing one.
>> This question may have come up before, but searching the usual sources
>> hasn't turned up anything
>> Michael Friendly Email: friendly AT yorku DOT ca Professor, Psychology
>> York University Voice: 416 736-5115 x66249 Fax: 416 736-5814
>> 4700 Keele Street http://www.math.yorku.ca/SCS/friendly.html
>> Toronto, ONT M3J 1P3 CANADA
>> R-help at r-project.org mailing list
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
Michael Friendly Email: friendly AT yorku DOT ca
Professor, Psychology Dept.
York University Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Street http://www.math.yorku.ca/SCS/friendly.html
Toronto, ONT M3J 1P3 CANADA
More information about the R-help