[Bioc-devel] How to import a setAs method in one's package?
Thankyou guys for your quick and helpful feedback! Aditya
From: Michael Lawrence [lawrence.michael at gene.com]
Sent: Friday, May 08, 2020 7:35 PM
To: Bhagwat, Aditya
Cc: bioc-devel at r-project.org
Subject: Re: [Bioc-devel] How to import a setAs method in one's package?
Sent: Friday, May 08, 2020 7:35 PM
To: Bhagwat, Aditya
Cc: bioc-devel at r-project.org
Subject: Re: [Bioc-devel] How to import a setAs method in one's package?
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 at 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 at 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 at gene.com Join Genentech on LinkedIn | Twitter | Facebook | Instagram | YouTube