[R] ! arithmetic
David Richmond
daver969 at yahoo.com
Sun Feb 16 07:58:03 CET 2003
you can create your own function:
> fact <- function(n) prod(1:n)
> fact(3)
[1] 6
> fact(10)
[1] 3628800
> fact(c(3,4))
[1] 6
Warning message:
Numerical expression has 2 elements: only the first used in: 1:n
fact() will work for scalars but doesn't do well with vectors.
Dave Richmond
On Saturday, February 15, 2003, at 07:33 PM, 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)! ?
>
> Thanks!
>
> Stan
More information about the R-help
mailing list