[R] find source code

Liaw, Andy andy_liaw at merck.com
Mon Jan 17 15:15:08 CET 2005


> From: r.ghezzo at staff.mcgill.ca
> 
> I am using R 2.0.2 on a WinXP

Does that version of R exist?

> I am trying to get the code of the Kruskal-Wallis test but
> > kruskal.test
> function (x, ...)
> UseMethod("kruskal.test")
> <environment: namespace:stats>
> 
> > ls(3)
>   [1] "acf"                  "acf2AR"               "add.scope"
> ..............
> [181] "kruskal.test"         "ks.test"              "ksmooth"
> .......................
> [475] "window<-"             "write.ftable"         "xtabs"
> 
> > class(kruskal.test)
> [1] "function"
> 
> > getS3method("kruskal.test","function")
> Error in getS3method("kruskal.test", "function") :
>         S3 method kruskal.test.function not found
> 
> > getS3method("stats::kruskal.test","function")
> Error in getS3method("stats::kruskal.test", "function") :
>         no function 'stats::kruskal.test' could be found
> >
> I searched the archives and the answer was ' use getS3method 
> ' . The help for
> getS3method is getS3method(f,class,optional=FALSE) so I am lost
> Can somebody tell me how to get the source listing of 
> kruskal.test or of any
> other hidden function?

Before you use getS3method(), you need to know which S3 method you want to
get.  To see what S3 methods are available, use:

> methods("kruskal.test")
[1] kruskal.test.default* kruskal.test.formula*

    Non-visible functions are asterisked

Andy

> Thanks
> Heberto Ghezzo
> Meakins-Christie Labs
> Canada
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 
>




More information about the R-help mailing list