R-alpha: three useful functions...

Gregory R. Warnes (warnes@biostat.washington.edu)
Mon, 9 Sep 1996 10:58:48 -0700 (PDT)


Date: Mon, 9 Sep 1996 10:58:48 -0700 (PDT)
From: "Gregory R. Warnes" <warnes@biostat.washington.edu>
To: r-testers <r-testers@stat.math.ethz.ch>
Subject: R-alpha: three useful functions...


I discovered that R does not yet include the functions sapply() and 
readline(), hence I have written substitutes that work fine for what I 
do.  I also was suprised to discover that neither R nor S seems to have a 
factorial function, so I include a function to do this.

I have added the three functions to the end of my $RHOME/library/base so 
that they are always available.  Here they are:

sapply := function(X, ...) { unlist( lapply( as.list(X), ... ) ) }
readline := function() system("read h; echo \"$h\"", TRUE)
factorial := function(X) round(gamma(X+1))

Greg



-------------------------------------------------------------------------------
    Gregory R. Warnes          | It is high time that the ideal of success
warnes@biostat.washington.edu  |  be replaced by the ideal of service.
                               |                       Albert Einstein
-------------------------------------------------------------------------------

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-testers mailing list -- To (un)subscribe, send
subscribe	or	unsubscribe
(in the "body", not the subject !)  To: r-testers-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-