On Sep 25, 2014, at 11:21 AM, C Lin wrote:

> Dear R users, 
> There is a package called NanoStringNorm with a function called 
> NanoStringNorm.
> What I want to do is to change the NanoStringNorm function from the package 
> with my own copy that is written in my.nanostringnorm.R. 
> But if I do the following: 
> 
> source('my.nanostringnorm.R")
> unlockBinding("NanoStringNorm", as.environment("package:NanoStringNorm")) ; 
> assign("NanoStringNorm", NanoStringNorm, "package:NanoStringNorm") ; 
> 
> Although, it now correctly called my NanoStringNorm, it doesn't recognize a 
> function called inside my NanoStringNorm that called another functions in the 
> NanoStringNorm package. 
> So, I have to change all such functionswith NanoStringNorm:::function.name. 
> How should I replace the NanoStringNorm function but still able to call other 
> function in the package? 
> I still have package NanoStringNorm in my search path but somehow it can't 
> find the other function. 

Take a look at assignInNamespace. It's also possible to set teh environment of 
a function:

?assignInNamespace
?`environment<-`


-- 
David Winsemius
Alameda, CA, USA

______________________________________________
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