[R] Factorial

Sundar Dorai-Raj sundar.dorai-raj at pdf.com
Wed Jul 3 23:27:25 CEST 2002

```
Alvaro Colina wrote:
>
> El mié, 03-07-2002 a las 19:55, Ricardo Da-Silva escribió:
> > Dear R Users
> >
> > Could someone tell me if R has a internal function or package to perfome
> > factorial calculations, like 32!,?
> >
> > Thanks
> > Rick.
> > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> > r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> > Send "info", "help", or "[un]subscribe"
> > (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> >
>
> Try gamma(n-1)

However, it's usually safer to use lgamma(n-1) instead if n is large (as
in n=32). lgamma(x) returns the log of the gamma function which will be
a more managable number for computational purposes.

> lgamma(31)
[1] 74.65824
> gamma(31)
[1] 2.652529e+32

Regards,

Sundar

--
Sundar Dorai-Raj, Ph.D.
Statistical Methods Engineer
PDF Solutions, Inc.
Dallas TX
(972) 889-3085 x216
(214) 392-7619 cell
sundar.dorai-raj at pdf.com
http://www.pdf.com/
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

```