Created
September 8, 2013 15:20
-
-
Save davetang/6485552 to your computer and use it in GitHub Desktop.
Function for calculating number of permutations without replacement
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
perm_without_replacement <- function(n, r){ | |
return(factorial(n)/factorial(n - r)) | |
} | |
#16 choices, choose 16 | |
perm_without_replacement(16,16) | |
#[1] 2.092279e+13 | |
#16 choices, choose 3 | |
perm_without_replacement(16,3) | |
#[1] 3360 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment