Dear list, I have two matrices A <- matrix(t(expand.grid(c(1,2,3,4,5), 15, 16)), nrow = 3) B <- combn(16, 3) Now I would like to exclude all columns from the 560 columns in B which are identical to any 1 of the 6 columns in A. How could I do this? Many thanks and best wishes, Alrik