Hello all,
I am developing an R package. My package uses several
classes and functions from another package (package A). Normally, I could just
specify package A as imports or depends in my DESCPRITION and NAMESPACE files.
One function I use is F, which calls a bunch of other
functions including G in package A. To use function F in my package, I have to
modify function G first. Therefore, I rewrite function G first and do 
assignInNamespace("G",
G, envir="A") in the source R file, either with or without .onLoad
function. Either way, the package was checked and installed free of error. But
after loading, my package still calls the original function G (through F) in
package A, instead of the version I supplied. 
Note that I may do assignInNamespace after my package gets
loaded in a user session, it works perfectly fine. I realize that I may
manually include in my package all the sources for relevant classes and
functions from package A and rewrite function G only. But that’s too awkward
and does not gives credit to package A.
I would really appreciate any thoughts and suggestions on
why assignInNamespace didn’t work in my source package, and how to solve it. 
Thanks!
Heyi

______________________________________________
R-help@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.

Reply via email to