Dear R Users, I have a question, how does one print an r function like t.test in R (to get the whole function and not just a summary of the environment)? For example if I type the following:> t.testfunction (x, ...) UseMethod("t.test") <environment: namespace:stats>> print(t.test)function (x, ...) UseMethod("t.test") <environment: namespace:stats> I don't get the entire function printed. Kind regards, -- Luwis Diya, Leuven Biostatistics and Statistical Bioinformatics Centre (L-BioStat), Kapucijnenvoer 35 blok d - bus 7001, 3000 Leuven, Belgium Tel: +32 16 336886 or +32 16 336892 Fax: +32 16 337015 [[alternative HTML version deleted]]
Hi Luwis, this task is solved in the R Help Desk, see R News 6/4 http://cran.r-project.org/doc/Rnews/Rnews_2006-4.pdf in short "t.test" is a S3-method and you can have a look at implemented methods with methods(t.test) and then use e.g. getAnywhere(t.test.default) hth. Luwis Tapiwa Diya schrieb:> Dear R Users, > > I have a question, how does one print an r function like t.test in R (to get > the whole function and not just a summary of the environment)? For example > if I type the following: > > >> t.test >> > function (x, ...) > UseMethod("t.test") > <environment: namespace:stats> > >> print(t.test) >> > function (x, ...) > UseMethod("t.test") > <environment: namespace:stats> > > I don't get the entire function printed. > > Kind regards, > > >-- Eik Vettorazzi Institut f?r Medizinische Biometrie und Epidemiologie Universit?tsklinikum Hamburg-Eppendorf Martinistr. 52 20246 Hamburg T ++49/40/7410-58243 F ++49/40/7410-57790 -- Pflichtangaben gem?? Gesetz ?ber elektronische Handelsregister und Genossenschaftsregister sowie das Unternehmensregister (EHUG): Universit?tsklinikum Hamburg-Eppendorf K?rperschaft des ?ffentlichen Rechts Gerichtsstand: Hamburg Vorstandsmitglieder: Prof. Dr. J?rg F. Debatin (Vorsitzender) Dr. Alexander Kirstein Joachim Pr?l? Prof. Dr. Dr. Uwe Koch-Gromus
On Mar 31, 2010, at 8:35 AM, Luwis Tapiwa Diya wrote:> Dear R Users, > > I have a question, how does one print an r function like t.test in R > (to get > the whole function and not just a summary of the environment)? For > example > if I type the following: > >> t.test > function (x, ...) > UseMethod("t.test") > <environment: namespace:stats> >> print(t.test) > function (x, ...) > UseMethod("t.test") > <environment: namespace:stats> > > I don't get the entire function printed.> methods(t.test) [1] t.test.default* t.test.formula* Non-visible functions are asterisked # Noting the asterisk, one need to use getAnywhere() > getAnywhere(t.test.default) A single object matching ?t.test.default? was found It was found in the following places registered S3 method for t.test from namespace stats namespace:stats with value function (x, y = NULL, alternative = c("two.sided", "less", "greater"), mu = 0, paired = FALSE, var.equal = FALSE, conf.level = 0.95, ...) ### snipped the code ----------------- There was an R-News a couple of years back by (if memory serves) Ligges describing various methods for getting at source. Yes, there it is: Ligges, U. (2006): R Help Desk: Accessing the Sources. R News 6 (4), 43-45. http://cran.r-project.org/doc/Rnews/Rnews_2006-4.pdf -- David Winsemius, MD West Hartford, CT
Reasonably Related Threads
- R2WinBUGS and R-2.10.0: The school example not running
- Obtaining the first /or last record of a subject in a longitudinal study
- Cross classified or Multiple membership or Hierarchical (3 level ) logistic models using Umacs
- Help in Compliling user -defined functions in Rpart
- codamenu() :Error in coda.options....