outer( c("aa", "ab", "cc"), c("aa", "ab", "cc") , "paste" ) vals <- c( c("aa", "ab", "cc"), c("aa", "ab", "cc") ) vals <- unique( vals ) combn( vals , 2 )