Skip to content

Instantly share code, notes, and snippets.

@davetang
Created September 8, 2013 15:20
Show Gist options
  • Save davetang/6485552 to your computer and use it in GitHub Desktop.
Save davetang/6485552 to your computer and use it in GitHub Desktop.
Function for calculating number of permutations without replacement
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