[R] source of R functions {was ... aov ...}

Martin Maechler maechler at stat.math.ethz.ch
Thu Jun 23 18:57:27 CEST 2005


>>>>> "RenE" == RenE J V Bertin <rjvbertin at gmail.com>
>>>>>     on Thu, 23 Jun 2005 17:37:14 +0200 writes:

    RenE> Thanks to all the others who replied.
 
      BDR> and do note it is unset again a few lines later.
      BDR> (Listing a function inside R is not giving you the
      BDR> `source code'.)

nor does RenE's   fix(aov)  {mentioned later in his post}.

We have been on this topic many times: The source code is in
*files*, publicly available from CRAN (and even with your web
browser from https://svn.R-project.org/R/ where e.g. tags/R-2-1-1/
contains the source of R 2.1.1).
And this applies to CRAN (or Bioconductor) packages as well as
the "base R" code:  The real source is in files.

Looking at the object {via "typing its name" or e.g. fix() or an
"object browser"} basically (not quite!) provides the result of
source() {+  save() and load() in some cases} of the original
source files; and this should be about the same as what you'd
get from  print( parse(...) ) of the source text.

What's the difference?   At least these:

1a) All the comments inside functions are lost.
1b) all other comments between object {typically function} definitions,
    and the grouping {into files; sections inside files, ...} 
    and logical sequence of the definitions is lost.
2) The author's formatting is lost.

3) only " ... " are used for strings (even when the original had '...')
4) numerical constants are shown in a uniform way, not as
   entered  { .1 |-> 0.1   1e1 |-> 10   etc }

where "1)" and "2)" can be important and I consider a drawback;
3 and 4 are less important and typically an advantage, 
and '2)' is an advantage for some people's R code because it
makes it prettier. (! ;-)

Martin Maechler, ETH Zurich




More information about the R-help mailing list