[BioC] Removing libraries or using a particular function

Seth Falcon sfalcon at fhcrc.org
Tue Jul 17 16:24:48 CEST 2007


Wolfgang Huber <huber at ebi.ac.uk> writes:

> Hi Daniel et al.
>
> Mark Robinson ha scritto:
>> ?detach
>> example:  detach(package:splines)
>> 
>> For the 'segment' function, you can call:
>> DNAcopy::segment
>> or
>> tilingArray::segment
>
> AfaIu, "detach(x)" works mostly but not 100%. It does not revert every
> possible change to the state of R that "library(x)" may have triggered.
> So I would not like to rely on it. (And I would be happy to be corrected
> if this statement is too pessimistic.)

Probably only slightly :-)

detach("package:tilingArray", unload = TRUE) will:

  * Detach the package from the search path

  * _Attempt_ to unload the package's namespace.  This will fail if
    another package is currently loaded that imports this namespace.
    You get a warning if it fails.

  * Finally, iff unloading the namespace succeeded, the S4 methods
    cache is refreshed.  If this doesn't occur, S4 methods will still
    be there but may or may not be on the search path.

  * There are also issues with dynamically loaded libs.  Not all
    packages request their lib to be unloaded; not all OSes can support
    such an operation in the first place.

> For the question that you asked, the "::" syntax is preferable. There is
> no guarantee (or reason to expect) that names in a package universe
> contributed by many people could be unique.

I agree and learning to use "::" is good advice.  If you get tired of
typing all of that in a session, you can make yourself an alias:

ta_seg = tilingArray::segment

Best,

+ seth

-- 
Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center
http://bioconductor.org



More information about the Bioconductor mailing list