-1

How can I use R to list all the permutations of 4 numbers??enter image description here

Aaron
  • 7
  • 1
  • Functions `Perm` in package `DescTools`, `permsn` in package `prob`, and `permn` in package `combinat ` to list just 3. It is not clear what your picture represents. You'll get a better answer if you provide data and a clear statement of what you are trying to do. – dcarlson May 24 '20 at 03:55
  • Please read [Why not upload images of code on SO when asking a question](https://meta.stackoverflow.com/questions/285551/why-not-upload-images-of-code-on-so-when-asking-a-question/285557#285557) and [edit] your question to include code and data as text, not images. – Nick May 24 '20 at 04:20
  • Probably you are looking for https://stackoverflow.com/questions/11095992/generating-all-distinct-permutations-of-a-list-in-r – Ronak Shah May 24 '20 at 04:36

1 Answers1

3
> library(combinat)
> permn(letters[1:3])
[[1]]
[1] "a" "b" "c"

[[2]]
[1] "a" "c" "b"

[[3]]
[1] "c" "a" "b"

[[4]]
[1] "c" "b" "a"

[[5]]
[1] "b" "c" "a"

[[6]]
[1] "b" "a" "c"
NobodyNada
  • 7,529
  • 6
  • 44
  • 51
Eric
  • 31
  • 2
  • Code-only answers are discouraged. Please click on [edit] and add some words summarising how your code addresses the question. Thanks – Nick May 24 '20 at 04:20