Date: Thu, 24 Jun 1999 08:34:25 +0200
From: Diego Kuonen <Diego.Kuonen@epfl.ch>
To: Alex Buerkle <cbuerkle@bio.indiana.edu>
Subject: Re: [R] does a factorial function exist
Alex Buerkle wrote:
> I've looked through the documentation with R-0.64.1 and have been unable
> to find a high-level function for evaluation of factorials (i.e., n!, not
> factorial designs). Is there such a function?
This should do the trick:
fact<-function(numb)
{
if (numb==0) out<- 1
if (numb<0) out<- 1
if (numb>0) out<- prod(seq(numb))
out
}
:-)
Diego Kuonen
-- ------------------------------------------------------ Diego Kuonen DMA - Ecublens, EPFL, 1015 Lausanne, Switzerland Phone : + 41 (0)21 693 5508 Fax : + 41 (0)21 693 4250 E-mail : mailto:Diego.Kuonen@epfl.ch Homepage : http://statwww.epfl.ch/people/kuonen ------------------------------------------------------ _ _ -o) "Linux - Ready For 2000 By Nature !" -o) /\\ /\\ _\_v "Penguins DO fly !" _\_v------------------------------------------------------
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._