The `summary' function (i.e. the generic) is defined in the "base"
package, the
source code of which is in src/library/base/R in the R source tree (try the file
"summary.R"). There are also a number of methods defined there.
The source code is not in the R *installation*, since the code for the
base/recommended packages is loaded via lazy-loaded databases. When looking for
source code, it's good to check the sources, not the installation.
The latest release source is at
http://cran.us.r-project.org/src/base/R-2/R-2.2.1.tar.gz
-roger
ivo welch wrote:> dear R wizards:
>
> I am trying to determine how to determine (no further recursion) where
> a built-in function is defined. In particular, I have decided I am
> going to add sd() to the existing basic summary function, rather than
> try to rewrite my own summary() function from scratch.
>
> So, I just installed R-2.2.1 (via gentoo; eventually I will figure out
> how to get atlas/sse/sse2 working on amd64, too! PS: [a] how can I
> determine whether a running S installation uses sse2, sse, and atlas?
> [b] does atlas use sse2; [c] are there now modern graphics processor
> routines that might speed up R, too? ok, all of these are irrelevant
> sidequestions).
>
> then, I did a
>
> > summary
> [not informative about which file it is defined in]
>
> ok, easy. Just grep. back on the unix line,
>
> # grep -r '1st Qu' /usr/lib/R
>
> which should look for this fairly unique string. to my surprise, it
> was only found in R-intro.html.
>
> so, how would I go about looking for where R defines functions? or
> has this becomes so deeply wired into fortran/C in later versions that
> it can no longer be changed?
>
> help/advice as always appreciated.
>
> sincerely,
>
> /ivo welch
>
> ______________________________________________
> 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
>
--
Roger D. Peng | http://www.biostat.jhsph.edu/~rpeng/