-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Wolfrum, Ed
Sent: Tuesday, October 18, 2005 2:27 PM
To: r-help at stat.math.ethz.ch
Subject: [R] Finding code for R functions
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:
function (x, ...)
UseMethod("mean")
<environment: namespace:base>
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".
function (x, ...)
UseMethod("prcomp")
<environment: namespace:stats>
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