Something like this?
library(sets)
B <- matrix(data = c(1, 4, 1, 4, 7, 7,
2, 5, 3, 6, 9, 10),
ncol = 2)
a <- as.set(apply(X = B,
MARGIN = 1,
FUN = function(t) pair(t[1], t[2])))
a
#> {(1, 2), (1, 3), (4, 5), (4, 6), (7, 9), (7, 10)}
Created on 2019-07-13 by the reprex package (v0.3.0)
I've never used sets before, so I don't know whether it'll be faster or not.