# Using `gtools` package: require(gtools) permutations(n = 9, r = 3, v = 1:9) # n -> size of source vector # r -> size of target vector # v -> source vector, defaults to 1:n # repeats.allowed = FALSE (default) # [Arun] [so/q/14704039] [cc by-sa 3.0] $Follow @igor_chubin cheat.sh