[R] Newbie
Jonathan Baron
baron at cattell.psych.upenn.edu
Thu Nov 22 15:59:33 CET 2001
>From owner-r-help at stat.math.ethz.ch Thu Nov 22 09:29:45 2001
> How can I calculate a factorial (as in 5! = 5*4*3*2*1)?
A search of past news messages at finzi.psych.upenn.edu yields
two suggestions:
prod(1:n)
gamma(n+1)
If you use it a lot you can put
factorial <- function(x) {prod(1:x)}
in your .Rprofile
> How can I calculate Cnp, the number of combinations of p elements
>out of n elements? I found binomial() but that is the binomial law and
>not simply Cnp.
I haven't tested the following, but it may answer your question:
http://finzi.psych.upenn.edu/R/Rhelp/archive/14369.html
> Does anyone have a *simple* R reference sheet for R beginners who
>only want to do simple things?
Yes. http://www.psych.upenn.edu/~baron/refcard.pdf
and I think this is also in CRAN. It is simpler than the kinds
of questions you just asked. Soon I plan to add a second page
dealing mostly with graphics. Jon Baron
Jon Baron
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list