How do I find the number of unique permutations for a PERMANOVA with an unbalanced design? From the PRIMER manual (p. 28 about Monte Carlo permutations; http://updates.primer-e.com/primer7/manuals/PERMANOVA+_manual.pdf), the number of unique permutations for a PERMANOVA with $a$ groups and $n$ replicates per group is:
$$
(an)![a!(n!)^a].
$$
However, what is the calculation if the study design is unbalanced? For example, one group with $4$ individuals, another with $5$, another with $6$? Is there a way to calculate the number of unique permutations with adonis2?

Thank you for pointing numPerms(). However, I am getting an incorrect answer, even with simpler examples.
# Create 2 groups of 5. 
myVec = c(rep("A",5), rep("B", 5))

# Define the permutation scheme. 
hh = how(within = Within(type = "free"),
          blocks = as.factor(myVec))

# Calculate number of permutations
numPerms(nobs(myVec), hh)

However, 2 groups of 5 should have 945 unique permutations, but this returns 14400. What did I do wrong?

Function permute::numPerms calculates the number of permutations for your current model. The permutations in vegan::adonis2 are based on this very same permute package, and if you have specific problems with permutations, you should consult the permute package. Use numPerms() and read its help page.
