Skip to content

write all the permutations of a set

3 messages · Arnau Mir Torres, Bernd Weiss

#
Am 24.03.2011 11:28, schrieb Arnau Mir:
library(gregmisc)
permutations(3, 3, letters[1:3])

gives

      [,1] [,2] [,3]
[1,] "a"  "b"  "c"
[2,] "a"  "c"  "b"
[3,] "b"  "a"  "c"
[4,] "b"  "c"  "a"
[5,] "c"  "a"  "b"
[6,] "c"  "b"  "a"

HTH,

Bernd