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? It is trivial to code, so everyone could write their own, but it also would be worthwhile as a standard tool. I'm guessing I am just overlooking it. ~^^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^ C. Alex Buerkle Ph: 812-855-9018 Jordan Hall 142 Fax: 812-855-6705 Department of Biology Indiana University Bloomington, IN 47405 cbuerkle at bio.indiana.edu -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
It used to be in there at one point. You can define your own as follows factorial <- function(x) gamma(x+1) It is an important omission. Ross -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Alex Buerkle <cbuerkle at bio.indiana.edu> writes:> 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? > > It is trivial to code, so everyone could write their own, but it also > would be worthwhile as a standard tool. I'm guessing I am just > overlooking it.gamma(n+1) not good enough? (or prod(1:n) for that matter). -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Wed, 23 Jun 1999, 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?Try function(n) {prod(1:n)} Nicholas -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
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 at 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 at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._