Skip to content

Commit

Permalink
num_permutations_hack
Browse files Browse the repository at this point in the history
  • Loading branch information
acoppock committed Sep 12, 2017
1 parent 3067917 commit 0510b0f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions R/obtain_num_permutations.R
Expand Up @@ -159,6 +159,9 @@ multinomial_coefficient <-
# https://www.statlect.com/mathematical-tools/partitions
if (N != sum(m_each)) {
stop("the sum of m_each must equal N.")
}
if (lfactorial(N) > 300){
return(Inf) # this is a hack!
}
factorial(N) / prod(factorial(m_each))
}
Expand Down
6 changes: 6 additions & 0 deletions tests/testthat/test-permutations.R
Expand Up @@ -171,3 +171,9 @@ rowMeans(perms)
perms %*% perm_probs


declaration <- declare_ra(N = 958, m = 479)

obtain_num_permutations(declaration)
obtain_permutation_matrix(declaration)


0 comments on commit 0510b0f

Please sign in to comment.