I have the following code creating all "paths" from and to
a which gives us 42 permutations.
library(gtools) library(tidyverse) x <- c( "a", "b", "c", "d", "e", "f", "g") df_permutations <- gtools::permutations(n = length(x), r = 2, v = x, set = TRUE, repeats.allowed = FALSE) %>% as.data.frame() names(df_permutations) <- c("source","target")
I now want to create permutations that vary where 2 or more permutations are selected from the created set
df_permutations and all those are then listed or saved into a list object (whatever works easiest).
Thus, I should have a run where only a to b is on and one where all 42 are also selected etc. I can't seem to put in a varying value for "r" unless I loop and add it together. Is this the best way of going about this?