From: Wolfrum, Ed <ed_wolfrum_at_nrel.gov>

Date: Wed 19 Oct 2005 - 07:26:33 EST

R-help@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 Received on Wed Oct 19 07:33:15 2005

Date: Wed 19 Oct 2005 - 07:26:33 EST

Greetings,

I am trying to figure out how to find the source code for R functions. I am specifically interested in finding the code for the "prcomp" function. I know that typing the function name without parenthesis will lead to the code (or to a .Internal or .FORTRAN or .C call). However, I don't really understand what is going on. For example, typing "mean" gives a "UseMethod" response, while typing "mean.default" give the actual code:

*> mean
*

function (x, ...)

UseMethod("mean")

<environment: namespace:base>

> mean.default

function (x, trim = 0, na.rm = FALSE, ...)
**---SNIP---
**

}

<environment: namespace:base>

Why is this? What does "mean.default" mean? I tried the same thing with "prcomp". With the stats package loaded, I cannot get to the source code for "prcomp".

> require(stats)

**[1] TRUE
**

> prcomp

function (x, ...)

UseMethod("prcomp")

<environment: namespace:stats>

> prcomp.default

Error: object "prcomp.default" not found

How do I find the prcomp code? Are there general rules for finding the source code for functions that I should know?

Thanks in Advance,

Edward J. Wolfrum, Ph.D.

National Renewable Energy Laboratory

Golden, Colorado

R-help@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 Received on Wed Oct 19 07:33:15 2005

*
This archive was generated by hypermail 2.1.8
: Fri 03 Mar 2006 - 03:40:46 EST
*