how to see the content of a R function in a package?
2
0
Entering edit mode
@james-anderson-1641
Last seen 9.7 years ago
An embedded and charset-unspecified text was scrubbed... Name: not available Url: https://stat.ethz.ch/pipermail/bioconductor/attachments/20070617/ e24d0768/attachment.pl
• 1.7k views
ADD COMMENT
0
Entering edit mode
@rathanasiadou-2085
Last seen 9.7 years ago
You mean typing the name of the function without parentheses or anything else following?(after you have called the appropriate package of course) niki ICB Swann Building The King's Buildings University of Edinburgh Edinburgh, EH9 3JR Scotland UK tel:(0044)0131-6507072 fax:(0044)0131-6505379 R.Athanasiadou at sms.ed.ac.uk -----Original Message----- From: bioconductor-bounces@stat.math.ethz.ch [mailto:bioconductor-bounces at stat.math.ethz.ch] On Behalf Of James Anderson Sent: 17 June 2007 17:00 To: bioconductor Subject: [BioC] how to see the content of a R function in a package? There seems to be a R command for doing this, I can not remember it though. Thanks, James --------------------------------- [[alternative HTML version deleted]] _______________________________________________ Bioconductor mailing list Bioconductor at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/bioconductor Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
ADD COMMENT
0
Entering edit mode
And if you want to see the source code of a function that is not exported in a package's namespace, you have to type the function's name without parentheses, as Niki pointed out, but precede it with the package name and three colons, for example: Biobase:::matchpt Regards, Joern r.athanasiadou wrote: > You mean typing the name of the function without parentheses or anything > else following?(after you have called the appropriate package of course) > > niki > > ICB > Swann Building > The King's Buildings > University of Edinburgh > Edinburgh, EH9 3JR > Scotland > UK > > tel:(0044)0131-6507072 > fax:(0044)0131-6505379 > R.Athanasiadou at sms.ed.ac.uk > > > -----Original Message----- > From: bioconductor-bounces at stat.math.ethz.ch > [mailto:bioconductor-bounces at stat.math.ethz.ch] On Behalf Of James Anderson > Sent: 17 June 2007 17:00 > To: bioconductor > Subject: [BioC] how to see the content of a R function in a package? > > There seems to be a R command for doing this, I can not remember it though. > > Thanks, > > James > >
ADD REPLY
0
Entering edit mode
An embedded and charset-unspecified text was scrubbed... Name: not available Url: https://stat.ethz.ch/pipermail/bioconductor/attachments/20070619/ 6e69c30f/attachment.pl
ADD REPLY
0
Entering edit mode
Hi James, that means that this function 'errorest' is only a S3 generic function and the effect of it depends on the class of the object it is invoked for. See for example this manual about method dispatching with S3: http://cran.r-project.org/doc/manuals/R-lang.html#Object_002doriented- programming The command methods("errorest") tells you that there is one function defined to work with data frames, called "errorest.data.frame", and that it is not exported in ipred's Namespace. You can get its souce code by typing ipred:::errorest.data.frame Typing ipred:::errorest.default tells you in addition that this S3 method is only defined for data.frames in ipred and not for other object classes, so this is probably what you are looking for. Best regards, Joern James Anderson wrote: > Thanks for your suggestions. I tried what you have suggested. I am trying to find the source code of function errorest in the R package ipred (I guess it's in CRAN, not bioconductor), I can only find: > > function (formula, data, ...) > UseMethod("errorest", data) > <environment: namespace:ipred=""> > > no matter what I type errorest, or ipred:::errorest, > if I type errorest(), there is some error message. > > James > -- Joern Toedling EMBL - European Bioinformatics Institute Wellcome Trust Genome Campus Hinxton, Cambridge CB10 1SD United Kingdom Phone +44(0)1223 492566 Email toedling at ebi.ac.uk
ADD REPLY
0
Entering edit mode
Hi James, here it is a bit more complicated to see the code. If you call > methods("errorest") [1] errorest.data.frame* errorest.default* you see all the available S3 methods for the different classes. To take a look on the code, you now have to call > ipred:::errorest.data.frame or > ipred:::errorest.default Best, Holger -------- Original-Nachricht -------- Datum: Tue, 19 Jun 2007 07:33:53 -0700 (PDT) Von: James Anderson <janderson_net at="" yahoo.com=""> An: Joern Toedling <toedling at="" ebi.ac.uk=""> CC: "\'bioconductor\'" <bioconductor at="" stat.math.ethz.ch=""> Betreff: Re: [BioC] how to see the content of a R function in a package? > Thanks for your suggestions. I tried what you have suggested. I am trying > to find the source code of function errorest in the R package ipred (I > guess it's in CRAN, not bioconductor), I can only find: > > function (formula, data, ...) > UseMethod("errorest", data) > <environment: namespace:ipred=""> > > no matter what I type errorest, or ipred:::errorest, > if I type errorest(), there is some error message. > > James > > Joern Toedling <toedling at="" ebi.ac.uk=""> wrote: And if you want to see the > source code of a function that is not > exported in a package's namespace, you have to type the function's name > without parentheses, as Niki pointed out, but precede it with the > package name and three colons, for example: > Biobase:::matchpt > > Regards, > Joern > > r.athanasiadou wrote: > > You mean typing the name of the function without parentheses or anything > > else following?(after you have called the appropriate package of course) > > > > niki > > > > ICB > > Swann Building > > The King's Buildings > > University of Edinburgh > > Edinburgh, EH9 3JR > > Scotland > > UK > > > > tel:(0044)0131-6507072 > > fax:(0044)0131-6505379 > > R.Athanasiadou at sms.ed.ac.uk > > > > > > -----Original Message----- > > From: bioconductor-bounces at stat.math.ethz.ch > > [mailto:bioconductor-bounces at stat.math.ethz.ch] On Behalf Of James > Anderson > > Sent: 17 June 2007 17:00 > > To: bioconductor > > Subject: [BioC] how to see the content of a R function in a package? > > > > There seems to be a R command for doing this, I can not remember it > though. > > > > Thanks, > > > > James > > > > > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: > http://news.gmane.org/gmane.science.biology.informatics.conductor > > > > --------------------------------- > > > [[alternative HTML version deleted]] > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: > http://news.gmane.org/gmane.science.biology.informatics.conductor --
ADD REPLY
0
Entering edit mode
@martin-morgan-1513
Last seen 11 days ago
United States
James, 'errorest' is an S3 generic (indicated by 'UseMethod' in its body). To see defined S3 methods, use > methods(errorest) [1] errorest.data.frame* errorest.default* Non-visible functions are asterisked This says there are two different functions defined, one for data.frame, one for default. Both are 'non-visible'. The S3 way to access non-visible functions is > getAnywhere(errorest.data.frame) (visible functions are accessible with just the full function name, e.g., print.default). Martin James Anderson <janderson_net at="" yahoo.com=""> writes: > Thanks for your suggestions. I tried what you have suggested. I am trying to find the source code of function errorest in the R package ipred (I guess it's in CRAN, not bioconductor), I can only find: > > function (formula, data, ...) > UseMethod("errorest", data) > <environment: namespace:ipred=""> > > no matter what I type errorest, or ipred:::errorest, > if I type errorest(), there is some error message. > > James > > Joern Toedling <toedling at="" ebi.ac.uk=""> wrote: And if you want to see the source code of a function that is not > exported in a package's namespace, you have to type the function's name > without parentheses, as Niki pointed out, but precede it with the > package name and three colons, for example: > Biobase:::matchpt > > Regards, > Joern > > r.athanasiadou wrote: >> You mean typing the name of the function without parentheses or anything >> else following?(after you have called the appropriate package of course) >> >> niki >> >> ICB >> Swann Building >> The King's Buildings >> University of Edinburgh >> Edinburgh, EH9 3JR >> Scotland >> UK >> >> tel:(0044)0131-6507072 >> fax:(0044)0131-6505379 >> R.Athanasiadou at sms.ed.ac.uk >> >> >> -----Original Message----- >> From: bioconductor-bounces at stat.math.ethz.ch >> [mailto:bioconductor-bounces at stat.math.ethz.ch] On Behalf Of James Anderson >> Sent: 17 June 2007 17:00 >> To: bioconductor >> Subject: [BioC] how to see the content of a R function in a package? >> >> There seems to be a R command for doing this, I can not remember it though. >> >> Thanks, >> >> James >> >> > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor > > > > --------------------------------- > > > [[alternative HTML version deleted]] > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor -- Martin Morgan Bioconductor / Computational Biology http://bioconductor.org
ADD COMMENT

Login before adding your answer.

Traffic: 575 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6