From: Thomas Lumley (tlumley@u.washington.edu)
Date: Tue 18 Feb 2003 - 05:15:11 EST
Message-id: <Pine.A41.4.44.0302171012380.88408-100000@homer39.u.washington.edu>
On Sat, 15 Feb 2003, Stan Markus wrote:
>
> Since "!" is a logical operator in R, how does one use it in its
> arithmetic sense, say to calculate x!/y!(N-y)! ?
>
- You can use gamma(x+1) for factorial, or the factorial() function in the
"gregmisc" package
- More usefully, you can use lgamma(x+1) to compute log factorials and
reduce overflow problems if any of the numbers is large
- It's also worth looking at choose() and lchoose() , which compute the
binomial coefficients and their logarithms.
-thomas
______________________________________________
R-help@stat.math.ethz.ch mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help
This archive was generated by hypermail 2.1.3 : Tue 01 Jul 2003 - 09:11:22 EST