I am trying to create a function that will do the following:
input: 1:3
output: 1 2 3 2 3 1 3 1 2
In this way i want to generate all permutations of the input where the elements never overlap for each given index
1 2 3 and 2 3 1 and 3 1 2
I have come as far as:
sapply(1:4,(function(i){paste0(i,i+1,i+2,i+3)}))
but this does not generate the output i am looking for.