[R] question about masked object

David Winsemius dwinsemius at comcast.net
Wed Oct 20 21:58:21 CEST 2010


On Oct 20, 2010, at 3:42 PM, Yunting Sun wrote:

> Hello,
>
> I encounter the problem that one library I use masks the function  
> gam in
> another library I use so that the gam in the other library can’t  
> function
> correctly.   Is it possible to damask?   I detach one of the library  
> but the
> masking problem is still there.

Dear gigi;

There is a special syntax for detaching packages and since you have  
not shown what you did, it is not possible to determine what is  
happening (or not).

?detach
# Perhaps:
detach(package:unwanted)

If you want to use a function, say "weighted.mean",  in a package, say  
"Hmisc" that has been masked by another package, then use the "::"  
operator to pull it out of its namespace:

Hmisc::weighted.mean(arguments)   # I don't know if this is a real  
function

Further (real) example after loading Hmisc.

 > units
function (x, ...)
UseMethod("units")
<environment: namespace:Hmisc>
 > base::units
function (x)
UseMethod("units")
<environment: namespace:base>


> Thank you and kind regards,
>
> gigi
>
> 	[[alternative HTML version deleted]]
-- 

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list