Explore Courses Blog Tutorials Interview Questions
0 votes
in R Programming by (50.2k points)
I want a list of all the permutations of 4 numbers in R, how can I get that?

1 Answer

0 votes
by (108k points)

For getting all the  permutations, refer to the following code:

> library(combinat)

> permn(letters[1:3])


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


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


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


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


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


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

Learn R programming from scratch, if you are a beginner in R. 

Browse Categories