[R] Find the package of a class given classname

Hervé Pagès hpages at fhcrc.org
Sat Jan 11 07:28:51 CET 2014


Hi Yuan,

On 01/10/2014 06:49 PM, Yuan Luo wrote:
> How to find the package of a class given classname?
> For example, there is a class called GAlignments, I want to do something
> like
> attr("GAlignments", "package") that gives you the package where the class
> is defined? But of course, attr("GAlignments", "package") won't work...

You didn't say whether you wanted to be able to do this
programmatically.

If that's the case maybe you're lucky and the package where the class
is defined is already attached to your session. In that case:


   > attr(class(new("GAlignments")), "package")
   [1] "GenomicRanges"

Otherwise, if the package in question is installed but not attached
you can still do:

   ??`GAlignments-class`

If the package is not installed but you have a vague idea that this
could be a Bioconductor container, then search the bioconductor
mailing list:

   http://bioconductor.org/help/mailing-list/

If that still doesn't give you the answer, then you're welcome to ask
on the list.

Cheers,
H.

PS: If you're using the current devel version of BioC (requires R devel)
the GAlignments class has moved to the new GenomicAlignments package.

>
> Thanks for any help!
> Yuan
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>

-- 
Hervé Pagès

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpages at fhcrc.org
Phone:  (206) 667-5791
Fax:    (206) 667-1319




More information about the R-help mailing list