From jorismeys at gmail.com  Fri Feb 24 12:26:06 2012
From: jorismeys at gmail.com (Joris Meys)
Date: Fri, 24 Feb 2012 12:26:06 +0100
Subject: [Rd] function remains loaded in the search space after
 detaching the package
In-Reply-To: <20295.29295.713484.449385@stat.math.ethz.ch>
References: <CAO1zAVbj-3ZS6zjPM9iR2+v_jZpccQNLqLsd4pm-jc7Yu6Jh2A@mail.gmail.com>
	<20295.29295.713484.449385@stat.math.ethz.ch>
Message-ID: <CAO1zAVbcTxB-92vNy6KDqKe_+DRtm5MGuZMn-=sN_2S4P8GRUQ@mail.gmail.com>

Aaargh... I should RTFM more closely.  Thanks for pointing this out.

On Fri, Feb 24, 2012 at 12:20 PM, Martin Maechler
<maechler at stat.math.ethz.ch> wrote:
>>>>>> Joris Meys <jorismeys at gmail.com>
>>>>>> ? ? on Fri, 24 Feb 2012 11:24:35 +0100 writes:
>
> ? ?> I ran into some very irritating behaviour I don't
> ? ?> understand. ?Let me illustrate with the package gdata()
> ? ?> and the function print.object_size() :
>
> ? ?>> print(object.size(iris),units='Kb')
> ? ?> 6.3 Kb
> ? ?>> getAnywhere(print.object_size)
> ? ?> A single object matching ?print.object_size? was found It
> ? ?> was found in the following places registered S3 method for
> ? ?> print from namespace utils namespace:utils with value ...
>
> ? ?> All is well. So now I load gdata
>
> ? ?>> require(gdata)
> ? ?> Loading required package: gdata ... ?The following
> ? ?> object(s) are masked from ?package:utils?:
>
> ? ?> ? ? object.size
>
> ? ?> OK, this is what I would expect:
>
> ? ?>> print(object.size(iris),units='Kb')
> ? ?> [1] 6424
> ? ?>> getAnywhere(print.object_size)
> ? ?> 2 differing objects matching ?print.object_size? were
> ? ?> found in the following places registered S3 method for
> ? ?> print from namespace utils namespace:gdata namespace:utils
> ? ?> Use [] to view one of them
>
> ? ?> Now I detach gdata again
>
> ? ?>> detach(package:gdata)
>
> ? ?> But the function print.object_size is still the default
> ? ?> for object_size objects!
>
> ? ?>> print(object.size(iris),units='Kb')
> ? ?> [1] 6424
>
> ? ?> And it can still be found as well:
>
> ? ?>> getAnywhere(print.object_size)
> ? ?> 2 differing objects matching ?print.object_size? were
> ? ?> found in the following places registered S3 method for
> ? ?> print from namespace utils namespace:gdata namespace:utils
> ? ?> Use [] to view one of them
>
> ? ?> Am I missing something?
>
> Yes: ?the argument ?'unload' ? of detach().
>
> In general: Now that every package has a namespace,
> you (and others) should learn the difference between
> attaching and loading - and hence ?detach()ing and unloading
> a package with its namespace.
>
> ??detach
> ??library
>
> etc should give a good start.
>
> Martin Maechler, ETH Zurich



-- 
Joris Meys
Statistical consultant

Ghent University
Faculty of Bioscience Engineering
Department of Mathematical Modelling, Statistics and Bio-Informatics

tel : +32 9 264 59 87
Joris.Meys at Ugent.be
-------------------------------
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php



[Rd] function remains loaded in the search space after detaching the package
Joris Meys