I need to receive all possible dataframes from the split of an original dataframe into all possible combinations of 3 columns. And all dataframes must contain id column. I'm at a dead end and do not know how to save all possible dataframes so that it will be possible to work further with all of them. One of the idea is to save them to list. But still I don’t know how to bind all necessary columns together. I find a close question to mine but it is still very different. Besides original dataframe has more than 1 mln rows and about 20 columns, so it is reasonable to use data.table.
frame <- data.frame(id = letters[seq( from = 1, to = 10 )],
a = rnorm(10, 4), b = rnorm(10, 6), c=rnorm(10, 5),
d = rnorm(10, 2))
combos <- data.table(combn(colnames(frame[,-1]), 3))
combos <- data.table(t(rbind(combos, t(rep(colnames(output2[,1]), ncol(combos))))))
names(combos) <- c('category_1', 'category_2', 'category_3', 'id')
list_tables <- apply(combos, 1, as.list)
Guys, I will appreciate any help. Thanks in advance