[Bioc-devel] How to import a setAs method in one's package?

Michael Lawrence |@wrence@m|ch@e| @end|ng |rom gene@com
Fri May 8 19:35:47 CEST 2020


setAs() defines methods on the coerce() generic, so you could write
importMethodsFrom(pkg, coerce). However, as() searches the namespace
associated with class(from) for coerce() methods. As long as that
namespace hasn't selectively imported methods on coerce(), it should
end up using the global table and find the appropriate method.

It's best to just importFrom() a generic to get access to its global
table, or import() the entire package. So Hervé's suggestion of
import(methods) is the right way to go

Michael.

On Fri, May 8, 2020 at 2:07 AM Bhagwat, Aditya
<Aditya.Bhagwat using mpi-bn.mpg.de> wrote:
>
> Dear BioC compatriots,
>
> How does one import a setAs method (which is generally not exported)?
> I in particular need to import as(., DataFrame) and am a bit puzzled on how to do this.
>
> Thank you!
>
> Aditya
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> Bioc-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel



-- 
Michael Lawrence
Senior Scientist, Bioinformatics and Computational Biology
Genentech, A Member of the Roche Group
Office +1 (650) 225-7760
michafla using gene.com

Join Genentech on LinkedIn | Twitter | Facebook | Instagram | YouTube



More information about the Bioc-devel mailing list