An embedded and charset-unspecified text was scrubbed... Name: not available Url: https://stat.ethz.ch/pipermail/r-help/attachments/20030613/33bc492f/attachment.pl
Factorial function in R?
4 messages · Peter.Caley@csiro.au, Ko-Kang Kevin Wang, Marc Schwartz +1 more
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? ********************************************************************* Dr Peter Caley CSIRO Entomology GPO Box 1700, Canberra, ACT 2601 Email: peter.caley at csiro.au Ph: +61 (0)2 6246 4076 Fax: +61 (0)2 6246 4000 ********************************************************************* [[alternate HTML version deleted]]
______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Cheers, Kevin ------------------------------------------------------------------------------ "On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question." -- Charles Babbage (1791-1871) ---- From Computer Stupidities: http://rinkworks.com/stupid/ -- Ko-Kang Kevin Wang Master of Science (MSc) Student SLC Tutor and Lab Demonstrator Department of Statistics University of Auckland New Zealand Homepage: http://www.stat.auckland.ac.nz/~kwan022 Ph: 373-7599 x88475 (City) x88480 (Tamaki)
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?
There is the factorial() function in the gregmisc package on CRAN, otherwise the gamma() function as has been mentioned. HTH, Marc Schwartz
"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 <><