[R] Factorial function in R?

Martin Maechler maechler at stat.math.ethz.ch
Fri Jun 13 08:38:55 CEST 2003


>>>>> "Marc" == Marc Schwartz <MSchwartz at medanalytics.com>
>>>>>     on 12 Jun 2003 21:21:39 -0500 writes:

    Marc> On Thu, 2003-06-12 at 19:53, Ko-Kang Kevin Wang wrote:
    >> AFAIK there isn't one.  You need to use gamma() or prod()
    >> (or writing up a recursive function if you want to be
    >> inefficient ;-D).
    >> 
    >> On Fri, 13 Jun 2003 Peter.Caley at csiro.au wrote:
    >> 
    >> > Date: Fri, 13 Jun 2003 10:44:40 +1000 > From:
    >> Peter.Caley at csiro.au > To: r-help at stat.math.ethz.ch >
    >> Subject: [R] Factorial function in R?
    >> > 
    >> > Is there a native factorial function in R [my searches
    >> have been > fruitless], or do I need to use gamma()
    >> function?


    Marc> There is the factorial() function in the gregmisc
    Marc> package on CRAN, otherwise the gamma() function as has
    Marc> been mentioned.

Yes, and also "gregmisc" doesn't have more than

     factorial <- function (x) gamma(1 + x)

something which we have thought to be too trivial to provide an
extra function name for -- particularly in light of the use of the
term "factorial" in something like "factorial design" in statistics.

If this question continues to pop up with such regularity, we
probably should reconsider...

Martin Maechler <maechler at stat.math.ethz.ch>	http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum  LEO C16	Leonhardstr. 27
ETH (Federal Inst. Technology)	8092 Zurich	SWITZERLAND
phone: x-41-1-632-3408		fax: ...-1228			<><




More information about the R-help mailing list