I am writing a function in R to test whether a set of points falls inside a set of polygons more often than would be expected by chance. The calculation of p value entails using factorials:
Now, it may happen that either 'n.of.points' or 'x' (or both) can be well above the limit of 170 (or 270, I do not recall) for the factorial function to be used. How can I still implement that calculation in R?
C-like:
p.x <- round((factorial(n.of.points)/(factorial(x)*factorial(n.of.points-x)))*(p^x)*(q^(n.of.points-x)),5)
Last edited: