Pairwise combinations of variables into data frames

Here is one method.

DF <- data.frame(A = 1:4, B= 2:5, C = 3:6)
NamePairs <- combn(names(DF), 2)
OutList <- vector("list", length = ncol(NamePairs))
for (i in 1:ncol(NamePairs)) {
  OutList[[i]] <- DF[, NamePairs[,i]]
}
OutList
#> [[1]]
#>   A B
#> 1 1 2
#> 2 2 3
#> 3 3 4
#> 4 4 5
#> 
#> [[2]]
#>   A C
#> 1 1 3
#> 2 2 4
#> 3 3 5
#> 4 4 6
#> 
#> [[3]]
#>   B C
#> 1 2 3
#> 2 3 4
#> 3 4 5
#> 4 5 6

Created on 2023-05-27 with reprex v2.0.2